Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have made a publishing page layout that has a WebPartZone and a MediaWebPart in the ZoneTemplate. Example below.

<WebPartPages:WebPartZone runat="server" Title="Fokusøki Media" ID="WebPartZone1" AllowLayoutChange="true" AllowPersonalization="false">
  <ZoneTemplate>
    <PublishingWebControls:MediaWebPart ID="mediaWebPart1" AutoPlay="true" AllowEdit="true" AllowClose="true" Title="MediaWebPart" runat="server" />
  </ZoneTemplate>
</WebPartPages:WebPartZone>

The WebPart show just fine on the page, and works like supposed. But when i click "Save and Close" or "Publish" on the ribbon, I get the following error message.

The operation could not be completed because the Web Part is not on this page. Stack Trace:

[WebPartPageUserException: The operation could not be completed because the Web Part is not on this page.]
   Microsoft.SharePoint.WebPartPages.SPWebPartManager.ThrowIfNotOnPage(WebPart webPart) +27111847
   Microsoft.SharePoint.WebPartPages.SPWebPartManager.GetStorageKey(WebPart webPart) +30
   Microsoft.SharePoint.Publishing.WebControls.MediaWebPart.UpdateWebPartProperties() +380
   Microsoft.SharePoint.Publishing.WebControls.MediaWebPart.OnLoad(EventArgs e) +49
   System.Web.UI.Control.LoadRecursive() +66
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428
share|improve this question
    
Is your publishing infrastructure enabled? Did you check out the page before editing? –  Mike Nov 13 '12 at 22:22
    
@Mike. Yes it is enabled and yes, the page was checked out. –  Oddmar Dam Nov 13 '12 at 23:30

1 Answer 1

Try adding the web part to the page layout using as mentioned here: https://achrafsp.wordpress.com/2013/05/31/provisioning-webparts-declaratively-and-programmatically

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.