Replace GUID with List Name in a SharePoint DataView

Recently I was experimenting with DataViews using SharePoint Designer (SPD). Basically the SPD  interface allows you to joins two lists so you can produce a view with merged data, kind of like what you would do with a SQL JOIN query.

Well it works fine for basic queries on a live site, but there are drawbacks for planned development, such as it uses GUIDs of lists rather than a name of the list. As lists have different GUIDs across environments (even if you create a feature/code etc to deploy lists) the DataView will not deploy properly across environments as the GUID will be different.

This can be easily overcome if you open the code view of the SPD page to the Query section. The list ID will be the default GUID of the lists, just change the ListName property of the SPDataView to the Name of the list!



You can then deploy this page as part of a feature or whatever to help move this code across your environments.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: