Thursday, November 24, 2011

SharePoint Content Export and Import – Importance of retaining GUID’s

We had to move some stuff from one environment to other.

There were number of Pages, Lists & Libraries, etc. The Pages has static content, custom and Out of Box Web Parts and whatever else you will normally have on a large SharePoint site.
There were 100+ pages, so it was not feasible to recreate them manually on destination environment.

We initially used SharePoint Granular Backups, available in Central Admin, to export from Source and then import using PowerShell into Destination environment. We restored the lists and then the pages library.

Post restoration, we had all the pages. Some of the pages worked as expected. However, webparts on some pages will not work as expected. For e.g. the Content Query Web Part (CQWP) will not display content and display a message that the query fired is not valid.

Guess, what was wrong? What were we missing?

The CQWP seems to internally keep a reference to the List GUID and not the List name. Same with few other web parts like the Image Slider Web Part.

To resolve, we exported using Content Management API and while importing, ensured that we retain the GUID’s. All the web parts are not working as expected.
We used Chris o'brien’s Sharepoint Content Deployment wizard  which is available on CodePlex for export and import. We however plan to replace it with PowerShell to automate the deployment process.

Note: You cannot import the list twice with same GUID to same content database. It will throw an error.
Key message of this blog: Important to retain GUID’s while exporting and importing lists and libraries if you have dependent pages/web parts internally referring them using GUID's

1 comment:

Anonymous said...

Try using export/import instead. This should create unique site IDs and help avoid the error that you’re running into. Here are links to TechNet documents for each of the commands:

Export a site, list, or document library in SharePoint Server 2010
http://technet.microsoft.com/en-us/library/ee428301.aspx

Import a list or document library in SharePoint Server 2010
http://technet.microsoft.com/en-us/library/ee428322.aspx
-Pankaj Lahoti (Wipro)