Copied to clipboard

Flag this post as spam?

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


  • Jakob Jensen 23 posts 43 karma points
    Dec 02, 2010 @ 13:38
    Jakob Jensen
    0

    Set property on Document.New

    I am working on a stock status, and I need the stock property to be set to 0 when a new document  of a specific doctype I created.

    Any ideas???

  • Rich Green 2246 posts 4008 karma points
    Dec 02, 2010 @ 13:41
  • Rich Green 2246 posts 4008 karma points
    Dec 02, 2010 @ 13:52
    Rich Green
    1

    Ahh, or did you mean the API?

           DocumentType textPageType;
                Document myPage;
    
    
                textPageType = DocumentType.GetByAlias("DocTypeName");
                myPage = Document.MakeNew("NameOfNode", textPageType, User.GetUser(0), parentNodeID);
    
                myPage.getProperty("stock").Value = "0";
    
                myPage.Publish(User.GetUser(0));
                umbraco.library.UpdateDocumentCache(myPage.Id);

    Rich

Please Sign in or register to post replies

Write your reply to:

Draft