Saturday, January 12, 2013

How to move a Data View Web Part to another site or server in Moss-2007


A Data View Web Part (DVWP) is a web part created using SharePoint Designer that can display data from just about any kind of data source, inside or outside of SharePoint.  Moving the web part from site A to site B or from server A to server B should be as simple as exporting it from one site and importing it into the other. Should be… 

If the DVWP is not using data from a SharePoint list, then moving it is pretty easy.

From the site where you created and tested the DVWP:

1.             Click the dropdown arrow in the web part's title bar, click Export and save the file

2.             Move the file to the other server if needed

3.             Open the new site and the page for the web part

4.             Click Site Actions, Edit Page

5.             Click Add a Web Part

6.             At the bottom of the popup window click “Advanced Web Part gallery and options”

7.             Now for the tricky part… find the Import button! 
In the “Browse” bar at the top of the panel there is a dropdown arrow. Click it and click Import

8.             Browse to your exported file and click Upload

9.             Drag the uploaded web part (usually a yellow bar with the name of the web part) to the desired web part zone 

If the DVWP is using data from a SharePoint list then you have a little more work.

Your web part will have a Globally Unique ID (GUID) to indentify the list. This ID will be different for every list you create.

First get the GUIDs (There are several ways to do this, here’s one…)

1.             Go to the list in the site where you created the DVWP and go to the list or library

2.             Click Settings and List (or library) Settings

3.             Look in the browser’s address bar and you will see something like this: 
http://maxsp2007/sites/training/_layouts/listedit.aspx?List=%7B81588B61%2D860D%2D4487%2DB81F%2DA1846A37954B%7D

4.             Copy everything after the “List=” and paste into Notepad  
You should now have something like this in Notepad: 

%7B81588B61%2D860D%2D4487%2DB81F%2DA1846A37954B%7D 
 

5.             The GUID you copied is encoded. You now need to clean this up

1.             Delete the “%7B” at the beginning

2.             Delete the “%7D” at the end

3.             Do a search and replace and change “%2D” to “-“  (a dash)

6.             Export the DVWP - click the dropdown arrow in the web part's title bar and click Export and save the file

7.             Open the exported file in another Notepad

8.             Search for the GUID you just cleaned up and replace with the name of your web part (“Announcements”)

9.             Search for “ListId” and replace with “ListName”   (capitalization is important here)

10.          Save the file and then import the web part using steps 3-9 in the first set of instructions above.

If you see “Unable to display this Web Part. To troubleshoot the problem…” then you messed something up with the GUID, the ListId vs ListName, or maybe the source list has a column the destination list does not.

No comments:

Post a Comment