I have a published PageNode and I want to edit its PageData. To be exact I want to access some of the page's widgets and change some values. I figured that all out and it at least seems to work.
However, I use PageNode's GetPageData() -function to get the Pagedata and with that I get the Live version of the PageData and it seems that my changes get overrun when I republish the page.
We use the code:
var bag = new Dictionary<string, string>();
WorkflowManager.MessageWorkflow(pageNode.Id, typeof(PageNode), null, status, false, bag);
for publish operation because we sometimes also have to unpublish pages and this operation isn't supported by PageNode's ApprovalWorkflowStatus. But this overruns my changed Live PageData. Without running this publish the changes are visible in live site but not in page editor (since it probably uses Master version to create Draft?)
So want to get the Master version to edit and re-publish it. Should be very simple scenario but to my amaizement it has been pretty hard. If I know the PageNode or Live PageData how can I access the Master version?!
Tried a lot of different things but none seem to work, some methods return some strange PageDraft object and none of the stuff like this
IQueryable<PageData> pages = pageManager.GetPageDataList().Where(pData => pData.Status == ContentLifecycleStatus.Master && pData.NavigationNodeId == pageNode.Id);
seems to work, returns an empty list.