Hi everyone!

I thought I’ll start of this blog with a simple, yet very useful solution made with data views in SharePoint Designer. Recently I faced a problem where I wanted every team site within our project area to show some mandatory information on the start page of each site. The standard Contact details web part was not enough and I needed more specific information like the Management Description of the project, who was the project manager, time frame, etc.

So what I did was that i added a few columns to the Site Directory in the project area (in this case a separate Site Collection). Besides the columns that should hold the project information I also added a column where I stored the site url, for example if the project site had the url http://MossServer/ProjectX I stored ProjectX in my custom made column in the Site Directory.

By doing that I could with help from SharePoint designer drop a Data view on to the start page of my project site and then use the filter options and some XSLT to match the current URL with the Site Directory and show the corresponding data. Taking this forward and by useing MOSS with the Business Data Catalogue you could actually use the Site Directory as a router for information from other Line of Business Applications like SAP.
When I was finished with my project site I saved it as a Site Template. And since I used the Site Directory to create new Project sites, all the information was automatically added when I added the site. This could of course be done with a workflow if you don’t use the Site Directory as a site list.

Below is short “how to” for the SharePoint Designer part.

1. Open up your site in SharePoint Designer and then open the default.aspx, If you are a safe player I recommend you to make a copy of the default.aspx file and work with that one.

2. Use the Data Source Library on the top right corner and choose connect to another library to make the connection to, in my case, the Site Directory list. At the bottom of the Data Source Library you find Connect to another library…

connecttoanotherlibrary

3. When the connection is made you will see your new connection in the Data Source Library List. In example the list is named Projects.

 datasourcelibrary

4. Drag and drop your list from the Data Source Library to you default.aspx site. Or if you just want some specific columns from the list, right click on the Projects list and choose Show Data. Then you will be able to drag and drop only those fields that you want (This could be done easier from the Data View properites)

5. On you default.aspx site you will now get a Data View. Mark the Data View and you will see an arrow to the right, by clicking on it you will have lot of options for customizing the Data View. But the one we are interested in is the Filter option. 

 dataviewproperties

In the window that opens up click on the XSLT and past the following code:

[@Project_x0020_Name=substring-after(substring-before($SiteURL,'/default.aspx'), '/')]

What we do here is that we get the Project Name (@Project_x0020_Name) from our Added data Source Library in this example the Projects list and this could be the Site Directory or any other list. Then we compare it with the URL of the current site by trimming the URL so that we get rid of the servername and default.aspx part.

That’s it for now, hope you find it useful.



  1. It‘s quiet in here! Why not leave a response?