Copied to clipboard

Flag this post as spam?

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


  • Ali Sheikh Taheri 470 posts 1648 karma points c-trib
    Mar 01, 2013 @ 18:19
    Ali Sheikh Taheri
    0

    v6 CreateContent and properties

    Hi 

    I am using the below code to create a content. 

    var contentService = ApplicationContext.Current.Services.ContentService;
    
    var content = contentService.CreateContent("myPage", -1, "TextPage");

    But I dont know how to set values of the TextPage properties. like headerText and bodyText?

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 01, 2013 @ 20:40
    Jan Skovgaard
    100

    Hi Ali

    You should be able to use the SetValue method...Like this

    content.SetValue("myProperty",value);

    And to Save and publish use

    contentService.SaveAndPublish("content);

    For more examples have look at this blog post introducing the new API http://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api.aspx

    Hope this helps.

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft