Geeks With Blogs

Lance's TextBox

RecentDocumentsImg This post is the second in a series of postings, containing examples of SharePoint WebParts that anybody can build all by themselves.  To read all posts in this series, or to get started with the RSSBus WebPart, go here.

#2 – List Document Libraries and Documents

For this example, we’ll make a web part that displays a list of the most recently modified document libraries/documents on the site.  Lots of SharePoint sites contain many libraries, each containing dozens or even hundreds of documents.  Often times it is difficult to view a quick list of the most recently modified documents in these libraries, or even just to view a quick list of all the libraries period.  This template makes it easy to do both of these things.

Step one is to make sure you have the RSSBus Web Part installed.  See here for instructions.

Step two, just make sure you have some document libraries with some documents in them.  This step should be pretty easy, if not you’re doing something very very wrong.  :)

Finally, step three, add the RSSBus WebPart to your page and paste the following template into its source editor.  Click "Apply" in the template editor and the template will go into effect, giving you a list of recently modified libraries and documents.

<input name="maxlibraries" default="5" />
<input name="maxdocuments" default="5" />

<rsb:call op="spListLists?listtype=DocumentLibrary" save="lists" />
table width="100%">
rsb:call op="feedSort?type=date&sort=-sp:item_modified&feed=[[_feeds.lists | urlencode]]" pagesize="[[maxlibraries]]" >
<th style="background-color:LightGrey; white-space:nowrap" colspan="2">
<a href="[[sp:url]]">[[rss:title]]</a>
<rsb:call op="spListDocuments?library=[[rss:title]]" save="mydocs" />
<rsb:call op="feedSort?type=date&sort=-sp:modified&feed=[[_feeds.mydocs | urlencode]]" pagesize="[[maxdocuments]]" >
<td><a href="[[sp:url]]">[[rss:title]]</a></td>
<rsb:set attr="today" value="[[sp:modified | todate('MM/dd/yy')]]" />
<rsb:equals attr="today" value="[[null | date('MM/dd/yy')]]">
[[sp:modified | todate('hh:mm:ss')]]
[[sp:modified | todate('MM/dd/yy')]]

This template lists all of your document libraries and sorts them by their last modified dates.  Then for each of those libraries, it lists the documents within and sorts those by their last modified dates.  The result is a view of the most recently modified documents on the site. 

After you paste this template into the source editor, click Apply!  You can customize the html in the template if you want, or leave it as is.  At this point you can change maximum number of libraries and documents that will be listed in the view by setting those properties in the property tab of the designer.

See all posts in this series:  10 DIY SharePoint Web Parts.
Browse RSSBus Connectors.
Basic RSSBus Scripting Cheat Sheet.


Technorati Tags: , ,
Posted on Tuesday, July 7, 2009 3:22 AM | Back to top

Comments on this post: 10 DIY SharePoint Web Parts #2

# re: 10 DIY SharePoint Web Parts #2
Requesting Gravatar...
If you can show a SAMPLE image in each of these BLOG pages that can be a great value add.
Left by Prasanna on Oct 31, 2009 10:48 AM

Your comment:
 (will show your gravatar)

Copyright © Lance Robinson | Powered by: