Take the community feedback survey now.
AI OnAI Off
Take the community feedback survey now.
I have also tried the following, which gives the same error?
exportingPage.SetValue("ReadyToMirrorLanguage", false);
OK, I have solved the first bit
PageData modifiablePage = exportingPage.CreateWritableClone();
modifiablePage.SetValue("ReadyToMirrorLanguage", false);
modifiablePage.SetValue("MirrorPage", false);
DataFactory.Instance.Save(modifiablePage, SaveAction.Publish);
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".[]"
If you want to save the page without access checks performed you could make the call to save like:
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; if (!exportingPage.Property["MirrorPage"].IsNull) { bool readyForMirroring = (bool)exportingPage.Property["MirrorPage"].Value; if (readyForMirroring) { e.Cancel = false; } exportingPage.Property["MirrorPage"].Value = false; exportingPage.Property["ReadyToMirrorLanguage"].Value = false; } }