By: Austin Gainey

 
 

Are you seeing this error message when creating or using a SharePoint 2013 Web Part?

SharePoint Web Part error message
 

If so, you’ve come to the right place. On a recent client project, a user reported this SharePoint 2013 web parts error to me after experiencing it when trying to create an embedded web part on a subsite of their site collection. I’ll be using this blog to share the solution I found for this error, and hopefully to also give you some general confidence when troubleshooting other SharePoint 2013 web parts errors!

 

The Situation

First things first, here’s a breakdown of the client scenario:

  • Client has a master task list at the root site collection level.
  • Client wants the SharePoint web parts to display the root level list (parent) on a subsite (child) page.
  • User created a list view web part referencing the task list at the root level.
  • User saved the web part locally, then uploaded the file to the Web Part Gallery at the root level.
  • When adding the newly created web part to a page on a subsite, the user received the error message I mentioned:

SharePoint Web Part error message
 

To add to the mystery, only a week prior the user was embedding SharePoint web parts on subsites via the above method without any errors! The only system change since then was an installation of the latest SharePoint Cumulative Update.

Given the timing, it seemed probable that the SharePoint CU had caused the functionality loss. However, web parts as a whole were still functioning normally…

 

The Solution

Armed with this information, I started digging into the web parts code. My logic was that due to SharePoint’s reliance on URL paths to reference content, the error message must have been pointing to a loss of reference.

I didn’t want to interfere with the user’s content, so I made sure I could reproduce the error on a test site collection. Here’s how I went about it:

Step 1. My first step was to check the references inside the web part. I had a suspicion that when the web part was applied to the subsite it was not pointing to the correct source. To do this, I examined the code of the web part and found a specific section that didn’t seem right…

SharePoint Web Part code issue
 

I don’t claim to be a smart man, but that many zeros for a property named “WebID” certainly raised some red flags.

Step 2. I felt I should start with the obvious and input the root site’s WebID GUID in place of the “00000000-0000-0000-0000-00000000.”

To find the WebID for a SharePoint site collection, I used a call to the SharePoint API. Simply open a new browser window and follow the below URL pattern to return the WebID.

  • https://intranet.yoursite.com/site/_api/web/id

The API response will look like this. We want the GUID at the end (which is the WebID).

SharePoint GUID
 

Step 3. After replacing the 0’s with the valid WebID value in the web part code, I saved the SharePoint web part file and uploaded the file to the site collection web part gallery.

To upload the SharePoint web part file to the web part gallery:

  • First, go to “Site Settings.”
     
    SharePoint settings
     
  • Under “Web Designer Galleries,” select “Web Parts.”
     
    SharePoint Site Settings
     
  • Upload the web part file to the Web Part Gallery.
     
    SharePoint Upload Document
     
  • Add the new web part to a page located on a subsite of the root.
     
    SharePoint Web Part option
     
  • After adding the web part to the page, the task list I created on the root is now viewable on a subsite!
     
    SharePoint working Web Part

Just as I suspected, a pesky lost reference strikes again! This easily could have been a much longer research process had the error message not prompted me to think of the references inside the web part. An added bonus is the user had very little downtime and was happy to have a work around for an important feature of their site!

 

Conclusion

Personally, as a SharePoint consultant, these are the types of scenarios I appreciate being documented by others due to SharePoint’s large platform. If this article helped you, or if you have something to add, please comment below!

 
 

Keep your data analytics sharp by subscribing to our mailing list!

Thanks for reading! Keep your knowledge sharp by subscribing to our mailing list to receive fresh Key2 content around data analytics, business intelligence, data warehousing, and more!

 
 
 
 


Key2 Consulting is a data warehousing and business intelligence company located in Atlanta, Georgia. We create and deliver custom data warehouse solutions, business intelligence solutions, and custom applications.