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...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
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...