Web Slices and SharePoint


 Last week, I read in a DL a question about how to show something cool, provide value and without custom code. Well there are many scenarios in SharePoint that empower final users in order to do this.

I instantly thought about WebSlices. As a microformat you can "decorate" your markup and include fast and easy additional funcionality to yourself or your colleagues (or even your users! :)).

What would I use to do it? Well I would start thinking in webparts that can be customized vis XSLT, or those that can render custom HTML. A quick list:

  • RSS Viewer WebPart
  • Core Search Results WebPart (any other search webpart)
  • Content By Query WebPart
  • Content Web Editor

Which will you choose? it will depend on your requirements (performance, data scope, skills). Here I will show the minimal implementation. From here you can build a custom page that leverage updates and notifications.

One MOSS challenge ;), would be to create a service that centralized these results!

I will use the federated results webpart, but configured to render synchronously.
Why?, because as you will face with the RSS Viewer webpart, you can't notifiy the client after "document ready" and you should implement "Alternative Display Source". I tried without it, and I faced some strange behaviour (sometimes the webslices icon appeared, but the Favorites Bar is not capable of showing the preview).

So it is just as easy as following the steps described at Subscribing to Content with Web Slices and (for this example) change:

  • Fixed KeyWord Query to Office 2010 (or whatever you want)
  • Customized Display Properties (number of results and length)
  • Add in the XSL Editor the classes required (in bold):
    • MainTemplate
      • <div class="hslice ms-searchsummarymain" id="LiveResults">
      • <div class="entry-title ms-searchChannelTitle">
    • MainTemplate.body
      • <div class="entry-content {$BodyClass}">

A picture is worth a thousand words:

Web Slices SharePoint

Other scenarios?

  • People Search showing collegues.
  • ChangeLog viewer
  • TFS bugs/tasks assigned to you
  • ...

 Finally, if we add code into the requirements, I would like to test a more dynamic solution:

  • Control Adapters to include all my webparts
  • EndPoints to get updates and notifications