Sharepoint 2010 Tip: Exception When Editing Pages - MediaWebPart and NullReference

28 February 2012

Had a confusing bug in a stage environment today where you could create pages (such as the inbuilt Article Page), but when you went to edit them it would through an exception:

System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.SharePoint.Publishing.WebControls.MediaWebPart.get_WebPartAdderId() at Microsoft.SharePoint.Publishing.WebControls.InsertMediaRibbonButton.RegisterRequiredScripts() at Microsoft.SharePoint.Publishing.WebControls.InsertMediaRibbonButton.OnPreRender(EventArgs e)

The first thing to check in this case is the permissions on your web part gallery (Site Collection Settings -> Web Parts) - it turns out that I had forgotten to undo an unrelated test that I had made in restricting web parts to specific users by breaking the list permission inheritance. Setting the gallery back to inherit permissions solved my issues and all users could now edit pages normally again.

Thanks to Chris Herdt for the tip!

Tags: exception, MediaWebPart, permissions, SharePoint 2010, Web Part Gallery

Add a Comment

No Comments