Monday, April 04, 2005

Modifying the Data Source for a Links Web Part

The Links list in a Windows Sharepoint Services (WSS) site provides a convenient way to inclue a group of hyperlinks on any page; however, the Links web part is hard-coded to reference only this list. Users who wish to create a separate list of links have no easy way to add an additional Links web part to their pages that will display content from their new list. Fortunately, the Links web part can be modified using Frontpage 2003 to achieve the desired functionality.

Each list in a WSS site has a specific database GUID associated with it. There appears to be no way to force the List web part to retrieve data from a different list in the web interface - you have to physically change the GUID embedded in the web part code. This requires you to edit the web part in Frontpage. If you're not used to working with ASP.NET code, don't worry - it's not all that tricky once you've done it a time or two.
Here are the steps involved:

1. Create the new list you want the web part to retrieve content from and add content to the list.
2. Click the Modify Settings and Columns link.
3. From the page URL in the browser address bar, cut and paste the portion of the URL in curly braces, including the braces (it should be near the end) into Notepad.
4. Insert a new List web part on the main page.
5. Edit the main page in Frontpage 2003.
6. In design view, click on the new web part so it is highlighted with a dark yellow border.
7. Switch to code view. The selection should be highlighted in black.
8. Scroll down and find the following line:
{GUID}http://schemas.microsoft.com/WebPart/v2/ListView">{GUID}
9. Replace the content in the curly braces with the portion of the URL you pasted into Notepad.
10. Save the page.
Now the web part will refer to the correct list and adding new links will show up in both the original list and the new web part.

Download this Tip as a PDF.