I am doing some custom checking on the Mirroring DataExporter_PageExporting event, to choose if I want to publish a given langauge branch or not. This works fine, and as expected. It works by checking a couple of selected/not selected properties on each page type.
I would like to reset these properties back to unselected once the page has been published.I have tried the following, but I get the error "Exception: The property MirrorPage is read-only."
void DataExporter_PageExporting(DataExporter dataExporting, EPiServer.Enterprise.Enterprise.PageExportingEventArgs e)
//find ready to mirror in each language, if one of them is set to true then allow the mirror
PageData exportingPage = DataFactory.Instance.GetPage(e.PageReference);
e.Cancel = true;
bool readyForMirroring = (bool)exportingPage.Property["MirrorPage"].Value;
e.Cancel = false;
exportingPage.Property["MirrorPage"].Value = false;
exportingPage.Property["ReadyToMirrorLanguage"].Value = false;
I have also tried the following, which gives the same error?
OK, I have solved the first bit
PageData modifiablePage = exportingPage.CreateWritableClone();
But, when I call the Save method, I now get "Exception: Access was denied to page 28_71. The required access level was "Edit, Publish"."
Is anyone able to suggest anything here please?
If you want to save the page without access checks performed you could make the call to save like: