Have you ever wanted to view multiple lists or document libraries from multiple sites in one place?
How about doing it without having to crack open SharePoint Designer or any other authoring tool?
What if we can use OOTB web parts and lists to make this happen?
Interested, then lets look at how we can do this. First off I have give thanks to Christophe for he developed the code to be able to view lists or libraries from different sites. You can find his two articles here: A simple method to display a list in another site and Display a list in another site (Cont’d)
Now his code shows us how to view a list on a page, but what we are going to do is allow you to create a list of lists (sounds odd) that you can easily select to view.
So what is this good for? Well let’s say that you access a task list, issues list, and a document library, which are all on different sites. Right now you have to go to each site to view the list that you are following. So now we have a solution so that on one site you can view all those list in one central place. We will also make it very easy for you to add a list or library to this view.
(List and Libraries on Multiple Sites)
Now we will be able to go ton one web page on a site and view all of those list in one place. For example this could be done on your My Site if you have MOSS or can be done on any other page within that site collection.
(List and Libraries viewed in one central place)
In the first step we need to create a list. This will be a custom list with only two additional columns added. So locate a site where you want to add this list. Feel free to name this list anything that you like.
After you add this custom list, you will then add the following two columns.
Link – The field name should be “Link” and it should be a “Single line of text”. Do NOT make it a Hyperlink field.
Site Link – The field can be any name, I chose “Site Link”. This field should be a calculated column. Then add the following code:
(View of new list with list/libraries added)
Nothing is wrong when you see Site Link looking like code. This is correct it to look like this. We will transform this code into a nice looking link later on.
In step two we are going to create a web part page. If you have a web part page that has already been created then skip to step 3.
Create a web part page and name anything you like. One thing I like to do when naming a page that is multiple work, like “List Collection” is to have the name as one word, like “ListCollection”. Why do I advocate this? It makes for clean URL’s. No “%20” in a URL. Then after the page is created I can edit the title of the page so that the name is changed from “ListCollection” to “List Collection”.
Ok, so you have created a web part page and so now it is time to add the web parts.
First we are going to add the custom list to the web part. I recommend that you add this web part to the left part of the page. Once added we need to make a few changes.
Change the the columns being viewed to just show the Site Link column.
Change the Toolbar Type to “Summary Toolbar”.
Do not worry that the Site Link look so much like code, we will address that next.
(View after adding the custom list)
Ok, so this is where we make it come alive. We are now going to add a CEWP and code to this web part page.
Add a Content Editor Web Part (CEWP)
Next click “open the tool pane” or select from edit “Modified Shared Web Part”.
Now we are going to add the code needed by selecting “Source Code”
Add the following code into the window that popped open:
Now you should be seeing something like this. See how the links that looked like code are now looking normal. Now click on any of your links on the left and your should see your list show up.
Last setup is to now just begin to add the list that you would like to see here. Go to the list itself, select a view or create a view. Once you are viewing the list in the view you like, select the URL and copy it. Come back to this site and click “Add new item”. Put a title in, past the URL in and save. You will now see your list, listed. Click and the view of your list will show up.
(Final result should look something like this)
Hope this helps.