Copied to clipboard

Flag this post as spam?

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


  • vijay 129 posts 152 karma points
    Dec 22, 2009 @ 13:58
    vijay
    0

    Giving Node Public access programatically?

    Hi,

    I am using below code to create and giving public access but Node is creating and it is giving error

    string strDocumentName = "Sample";//DateTime.Now.ToString("yyyy_MM_dd");           

            DocumentType dt = DocumentType.GetByAlias("TestApplication-Comment");
                    
            //author uses a dummy user called CommentWriter
            User author = User.GetUser(0);           

            Document doc = Document.MakeNew(strDocumentName, dt, author,Node.GetCurrent().Parent.Id);           

            Member myMember = Member.GetCurrentMember();

            //add properties           
            doc.getProperty("commentName").Value = myMember.Text;
            //doc.getProperty("commentBody").Value = tbComments.Text;
            doc.getProperty("commentID").Value = myMember.Id;
                    
            int loginDocId = 1479;
            int errorDocId = 1478;
            umbraco.cms.businesslogic.web.Access.ProtectPage(true, doc.Id, loginDocId, errorDocId);
            umbraco.cms.businesslogic.web.Access.AddMembershipRoleToDocument(doc.Id, "Visitors");
                   
            doc.Publish(author);
            umbraco.library.UpdateDocumentCache(doc.Id);

    Object reference not set to an instance of an object.

    Server Error in '/' Application.


    Object reference not set to an instance of an object.

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Dec 22, 2009 @ 14:14
    Dirk De Grave
    0

    Do you have stack trace info on this error?

     

    Cheers,

    /Dirk

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Dec 22, 2009 @ 16:46
Please Sign in or register to post replies

Write your reply to:

Draft