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 1647 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 11258 posts 23500 karma points MVP 7x 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

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies