Subscribe via RSS Feed Connect with me on LinkedIn

Creating an RSS reader using a Federated Search Web Part

[ 1 ] June 19, 2010 |

Overview

WSS 3.0 comes with a number of web parts but one that is missing, and is oft wanted, is an RSS reader that comes with MOSS. Where is it you say? Well its not there but if you install Search Server Express 2008 on top of WSS 3.0 or standalone you get access to a whole collection of search web parts.

Collection of search web parts when SSE2008 is installed

Collection of search web parts when SSE2008 is installed

Federated Results Web Part

So what does the Federated Results web part actually do. In essence it take a URL string with a parameter for search results that returns back well formatted XML in the form of ATOM or RSS and then renders that to display it to the user.If this sounds familar well it is, its virtually identical to the RSS Web Part that comes with MOSS but the Federated Results Web Part has a few more configuration options: allowing you to specify credentials, having parameters in the URL to access amongst others.

But we can fool this web part into acting like an RSS reader by simply not specifying the {searchterms} parameter in the URL string and a couple of other configuration options as listed below.

We will be using an RSS Feed from news.com.au with the url http://feeds.news.com.au/public/rss/2.0/news_mostpopular_travel_406.xml which will retrieve the latest popular travel stories.

1. Create a new Federated Location

First we have to create a new Federated Search Location since the Federated Results Web Part only allows you to choose from a drop down list of options. So go to Central Admin->SSP->Search Administration->Federated Location->New Location and you should see the screen below:

Federated Location Configuration Page

Federated Location Configuration Page

Fill in the following fields (we will get to Location Information, Display Information and Restrictions and Credentials information below).

  • Location Name: This is an unique ID that is only visible to Administrators of Sharepoint so most likely a short identifier can be used, we are using ‘RSS-News-Travel’.
  • Display Name: This is the name that will be visible when a user adds a Federated Results Web Part to a page, so in our case we are going to call it ‘Popular Travel Stories Feed‘.
  • Description: This is the description that is shown once again when a user selects an option from the web part so something useful shoule reside here like ‘Latest travel stories RSS Feed from news.com.au‘.
  • Author and Version: Self explanatory, we are going to leave these out.
  • Trigger: This is important as it specifies if the web part will fire on certain queries, in our case we are going to set it for always.

2. Location Information Configuration

Location Information

Location Information

This is really where the magic happens, instead of specifying a search string using the {searchterms} parameter we leave it out and add out rss feed location:

  • Location Type: This has to be set to OpenSearch 1.0/1.1
  • Query Template: Now in here we specify the URL of the RSS feed, we dont need to add the {searchterms} parameter since we wont be using it.
  • More Results Link Template: We don’t need this for our use so just leave it blank.

3. Display Information

Display Information Section

Display Information Section

In this section you can specify the XSL transform to use to transform the returned XML into HTML for rendering. We won’t be discussing it here but it is very useful to grab other fields from the feed if need be.

4. Restrictions and Credential Information

Restrictions and Credentials Information

Restrictions and Credentials Information

There are a couple of interesting sections here that I will go through.

  • Restrict  Usage: You can restrict where this feed can be used which is really useful if you have a lot of Federated options that you don’t necessarily want your user to have access to.
  • Specify Credentials: I love this section! Now you can choose different types of authentication for your feeds. So say you subscribe to a site that requires authentication through a user name and password log in page this can now be done within SharePoint and you can view your subscribed feeds easily.

So once you have all of this set, click on the OK button and you should see the new feed displayed in your Manage Federated Locations page.

So we now have this all set up, lets put it on the page and see how it works.

Adding your new Federated RSS News Feed to a page

Now we need to add the Federated web part to a page and see our results so lets do that! Now we don’t need to add this web part to a search results page since for an RSS feed we probably want it somewhere more prominent, like the home page of the site. So lets add it there.

1. Choose the Federated Search Web Part to add to the page

Federated Search Web Part option

Federated Search Web Part option

2. Choose our feed to display on the page

Choice of Federated Locations

Choice of Federated Locations

Click OK and we should be good to go….

3. Where the hell is my feed??

So as you can see there is nothing displayed on any page that is not a search results page. So why is that? Well if you ever look at the search results pages you can see that the search parameter is passed as a query string with the format of k={searchterm}.

k parameter

k parameter

It is this query string that causes all the other search results web parts to fire, wether this be search core results, best bets or federated results. So in order to get any page that contains our Federated Results XML feed to work we need to add the k={searchterm} to the URL. What I usually do is modify the navigation so that the home tab is changed from Default.aspx to Default.aspx?k=feed this will then fire the Federated Results web part and we have a nice RSS reader for our users to use!

Nothing is displayed with the K parameter

Nothing is displayed with the K parameter

Now with the k parameter we get our feed

Now with the k parameter we get our feed

Remember that you can also adjust the XSL to render this whatever way you like. Enjoy :)

Tags: , , ,

Category: How To

About Michal Pisarek: Michal Pisarek is the founder of Dynamic Owl Consulting and a Microsoft SharePoint MVP. View author profile.

Comments (1)

Trackback URL | Comments RSS Feed

  1. C. Marius says:

    Hi Michael,

    Great article, inspirational I might say!

    Have you considered using a Filter web part to send out the parameters?

Leave a Reply




If you want a picture to show with your comment, go get a Gravatar.