Important notice

Please note that this blog is discontinued here. All the posts are also coppied to my new blog at http://boris.gomiunik.net.
Important: Due to large amount of comment spam further commenting has been disabled here. If you wish to send me a comment, plase look up the same post on my new blog and leave comment there. Thanks!

8/17/2007

Resolving the "Unable to display this Web Part" problem after SharePoint Designer restore

If you've restored the SharePoint site using commands Site --> Administration --> Restore site and this site had special XSLT data views you may be in for a big surprise!

You can receive the following message:

Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator.

Or in Slovene language

Spletnega gradnika ni mogoče prikazati. Če želite odpraviti težavo, odprite spletno stran v urejevalniku HTML, združljivim s storitvami Windows SharePoint Services, kot je program Microsoft Office SharePoint Designer. Če težave ne morete odpraviti, se obrnite na skrbnika spletnega strežnika.

The problem is that while restoring the site, SharePoint designer doesn't correct the GUIDs of lists being used. For example: You're having an XSLT data view of a list called Contacts. When restoring SharePoint designer creates the list with a new GUID, but it uses the old GUID (from where the backup was made) of the list. The solution is simple: Fix the GUIDs of lists used in dataviews:

1. Open the Manage content administration page of your site (http://server/site/_layouts/mcontent.aspx)

2. Copy the shortcut of the list being used in XSLT to clipboard

3. In the URL you'll find the new GUID of a list between brackets ( in http://server/site/_layouts/ListEdit.aspx?List={89D731E5-0538-4999-B4AF-D7A5D9EA781F} the GUID is 89D731E5-0538-4999-B4AF-D7A5D9EA781F

4. With SharePoint Designer open the page with XSLT data view and search for term ListID in the code.

5. Select the value of the ListID parameter. It should be the GUID of the list (either in ListID="....." or in the same tag, look for GUID-like numbers.

6. Prest CTRL+H for Search and Replace with the value still selected. It will automatically populate the "Find what" field with it. Now paste the copied URL with GUID in the "Replace with" field and remove all but the GUID. Make sure you have the "Find in Source Code" option checked.

7. Now just press the "Replace all" button and your XSLT data view will magically come to life :).

I hope that this bug will be fixed with next version of SharePoint Designer, or maybe can develop some kind of plugin for that procedure to speed up the process for all the pages. I know that with FrontPage this wasn't happening.

10 comments:

Anonymous said...

I had an issue when moving a webpart from one environment to another, changing the listid fixed it, thanks!

Boris Gomiunik said...

Glad I could help :)

Anonymous said...

Hey Boris you're the greatest..!
10z for your sharing that solve my problem... :)

Boris Gomiunik said...

Thanks. Comments like yours keep me going :)

Anonymous said...

That exactly solved my problems. Thx !

Anonymous said...

This is still not helping. My ListName is what it should be and my ListId is the same as GUID from the URL (Parameter Name="ListID" DefaultValue="{E4F27DF6-D842-4603-AA50-B23CC63B14C6}").

The list displays fine in Designer but when I preview in browser I get the "Unable to display this web part...." msg.

Help!

Unknown said...

Thanks heaps - great post - very handy

Anonymous said...

"With SharePoint Designer open the page with XSLT data view and search for term ListID in the code"

How and why?

ummm.. this presumes I know how to do this in Designer.

thanks.

Boris Gomiunik said...

When viewing the page in in Internet Explorer, select File --> Edit with Microsoft Office SharePoint Designer (I assume you have it installed and as a default HTML editor).

Then select the webpart that has error and in View menu select Page and Split. Now you'll see the HTML code where you'll have to look for the word ListID.

Hope this helps. Btw for future comments could you leave them on http://boris.gomiunik.net? There you'll find the same posts as here plus quite some new ones.

Anonymous said...

Thanks for the step but I still face the same problem as before. As like other user, my ListID and GUID are the same. So find and replacing does not help in anything.

Please help. Thanks!