Tuesday, June 30, 2009

How to display list of MOSS Document Library, MOSS Surveys etc on your page

It seems quite obvious that one will have the requirements for displaying list of content collections like Document Libraries in current site or Surveys presents on current site.

I find that though it is very general requirement but there is no straight forward out of box solution in MOSS for displaying this simple information.

I first investigate Content Query Webpart but found that content query webpart is designed to fetch data related to contents within content collections rather then content collection itself.
In simple word you can fetch documents from multiple document library using content query webpart but it is not possible to get list of document libraries avialable.

I found one simple solution for it but obviously not acceptable as it doesnt display list on standard page or at an specific location on page. Solution is to add a menu item and set it URL to
//_layouts/viewlsts.aspx?BaseType=1
and it will display all document libraries with in site. Now this has several limitation and the biggest one is that it cannot be utilize as webpart.

Now 2nd solution for this is to use data view. Hummmmmmmmmmmmmmmm Sharepoint designer but still this can be achieved easily with the help of webservice avialable in sharepoint.

You need to do following step to achieve this

1. Create a connetion to web service
//_vti_bin/Lists.asmx?WSDL

2. Selection web function
GetListCollection

3. Connect DataView to connection created in step 1.

4. Filter results based on Base Type = 1 (In case of documents)

5.After finishing with above search

in code of your page and replace it with following in order to add link on document titles




shuuuuuuuuuuuuuuuuuuuu

thats it and it will add list of all document library in your page.

I hope this will help you in getting better understanding on how to utilize designer and data view to achieve this simple function of getting list of document library, survey or any other content collection.

No comments:

Post a Comment