Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Max 144 posts 166 karma points
    Apr 11, 2011 @ 12:42
    Max
    0

    Document.Copy() any idea??

    Iam using the code for document .copy in api usercontrol

    i am using this code but i get this error

    Document

     

    doc = new Document(Convert.ToInt32(Request.QueryString["id"]));    

    doc.Copy(doc.Parent.Id, doc.User);

     

    but i get this error:

     

    Method not found: 'Void umbraco.cms.businesslogic.web.Document.Copy(Int32, umbraco.BusinessLogic.User)'.

     

     

     

     

     

  • Daniel Bardi 927 posts 2562 karma points
    Apr 11, 2011 @ 12:55
    Daniel Bardi
    0

    What version of umbraco?

    Check that doc is not null..

  • Max 144 posts 166 karma points
    Apr 11, 2011 @ 15:59
    Max
    0

    i am using  teh latest version its not working

     

  • Max 144 posts 166 karma points
    Apr 11, 2011 @ 16:06
    Max
    0

    using

     

     umbraco.presentation.nodeFactory;

    not availabl ein teh new version That i am using

     

  • Max 144 posts 166 karma points
    Apr 12, 2011 @ 09:24
    Max
    0

     

     

     

     

     

     

     

     

     

     

     

     

     

     string newName;
                User author = User.GetUser(0);
                TextBox tb1 = this.txtNewName;
                newName = tb1.Text;
                string copyNodeID;
                copyNodeID = lblNodeId.Text;
                Document childDoc = new Document(int.Parse(copyNodeID));
               
                childDoc.Copy(childDoc.Parent.Id, author, true);

                foreach (Relation r in Relation.GetRelationsAsList(childDoc.Id))
                {

                    Document newDoc = new Document(r.Child.Id);
                    int idd = newDoc.Id;
                    newDoc.Text = newName;
                    newDoc.getProperty("VesselName").Value = newName;
                    newDoc.getProperty("dir").Value = "";
                    newDoc.getProperty("position").Value = "";
                    newDoc.getProperty("date").Value = "";
                    newDoc.Publish(author);
                    umbraco.library.UpdateDocumentCache(newDoc.Id);
                    r.Delete();

                }

     

    this is my code but i get this error of OBJECT NOT SET TO A REFERENCE OF AN OBJECT

     

  • Daniel Bardi 927 posts 2562 karma points
    Apr 12, 2011 @ 09:34
    Daniel Bardi
    0

    What line is giving the error?

  • Max 144 posts 166 karma points
    Apr 12, 2011 @ 13:22
    Max
    0

    the publish is giving error

     

  • Max 144 posts 166 karma points
    May 30, 2011 @ 10:47
    Max
    0

     

     

     

     

     

     

     

    Document childDoc = new Document(Convert.ToInt32(Request.QueryString["id"

    ]));

     

    // Document childDoc = new Document(1069);

    childDoc.Copy(childDoc.Parent.Id, author,

     

    true

    );

     

    foreach (Relation r in Relation

    .GetRelationsAsList(childDoc.Id))

    {

     

    Document newDoc = new Document

    (r.Child.Id);

     

    int

    idd = newDoc.Id;

     

    newDoc.Publish(author);

    umbraco.

     

    library

    .UpdateDocumentCache(newDoc.Id);

     

    it does not work dont know why??

  • Daniel Bardi 927 posts 2562 karma points
    May 30, 2011 @ 20:01
    Daniel Bardi
    0

    You should try saving the document before publishing it.

  • Max 144 posts 166 karma points
    May 31, 2011 @ 12:51
    Max
    0

    the problem was in the implementing interface in the code giving a get set value its fixed now thanks

     

Please Sign in or register to post replies

Write your reply to:

Draft