Mirroring DataExporter_PageExporting event


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;
Jan 18, 2011 17:46

I have also tried the following, which gives the same error?


exportingPage.SetValue("ReadyToMirrorLanguage", false);



Jan 18, 2011 17:55

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".[]"

Jan 18, 2011 18:05

Is anyone able to suggest anything here please?

Jan 21, 2011 17:38

If you want to save the page without access checks performed you could make the call to save like: 

DataFactory.Instance.Save(modifiablePage, SaveAction.Publish, EPiServer.Security.AccessLevel.NoAccess);
Jan 23, 2011 0:05
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.