Thanks for the code. It works, except for this line
It throws an exception saying Unauthenticated request. Most likely your session has expired. Please login and try again. I have given rights to Anonymous users to Edit page content, Create a page and Modify a page, so they should have enough rights.
Anyway, I don't need to use PageDrafts now. I'm having another issue now - I'm trying to add a ContentBlock to a PageData.Controls collection, but I can't find a way. Here's my code:
Guid tempGuid =
ContentItem genericContentItem = contentManager.GetItems<ContentItem>().Where(t => t.Id == tempGuid).FirstOrDefault();
PageControl pageControl = m_PageManager.CreateControl<PageControl>(genericContentItem, containerId);
Here the PageManager.CreateControl cannot accept Telerik.Sitefinity.GenericContent.Model.ContentItem as its first parameter. I'm currently pulling the text from the ContentItem's Content property and create a Telerik.Sitefinity.Modules.GenericContent.Web.UI.ContentBlock with this text, but if I change the contents of the ContentItem the changes won't be reflected in the page where I use this text.
Some code snippet how to do it would be highly appreciated.