Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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?
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
is working on a reply...
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.
Continue discussion
v6 CreateContent and properties
Hi
I am using the below code to create a content.
But I dont know how to set values of the TextPage properties. like headerText and bodyText?
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
is working on a reply...
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.