Display RSS feed with a XML Viewer WebPart in SharePoint Foundation

If you are working with SharePoint foundation and you would like to display an rss feed, for SharePoint Server you would choose to use the rss-viewer WebPart. In SharePoint Foundation there is no RSS-Viewer WebPart so you have to come up with an alternative.

From a customer I received the following request: They wanted newsfeeds from branch organizations all over the world combined into one rss feed and display that one on their corporate marketing portal. For the combine functionality I used “yahoo pipes”. It is an easy interface, with all options you need such as filtering, sorting etc. Once you created a pipe there is also a combined rss feed available that will show you all separate feeds into one.

To display that newly created rss feed, just put a XML-Viewer WebPart on your page in SharePoint 2010, add the url to the combined rss feed at yahoo. If you would hit enter now, the WebPart will display all properties the rss feed outputs. That is unreadable!

To make it readable you need to add some XSL formatting, for example enter the next code at your “XSL Editor”.

<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="yes"/> <xsl:param name="TITLE"/> <xsl:template match="rss"> <div style="background:#ffffff; padding:0; font-size:10px;"> <xsl:for-each select="channel/item"> <a href="{link}" target="_new"><xsl:value-of select="title"/></a><br/> <xsl:value-of disable-output-escaping="yes" select="description"/><br/> </xsl:for-each> </div> </xsl:template> <xsl:template match="description"><xsl:value-of select="."/><br/></xsl:template> </xsl:stylesheet>

Voilà, you have an alternative RSS-Viewer WebPart!

23 gedachten over “Display RSS feed with a XML Viewer WebPart in SharePoint Foundation

  1. hallo rick, top dat je dit plaatst op internet….
    Ik ben net begonnen met de ontwikkeling van sharepoint foundation en een van de zaken waar ik inderdaad tegenaan liep was de rss reader. Met bovenstaande kom ik er helaas nog niet helemaal uit. Ik heb een rss feed van accountancynieuws als xml opgeslagen (dmv een lokale rss reader) deze xml gekoppeld en bovenstaande xls toegevoegd. Ik krijg nu de melding:

    The XSL specified by the XSL property or XSL Link property is not valid, or the XSL file cannot be accessed. Make sure you have specified a valid XSL style sheet for this Web Part, or if the XSL file is linked that it can be accessed by the server. For assistance, contact your site administrator. More about making XSL files accessible.

    Kortom, het werkt dus niet….. Wat doe ik fout?

    • Beste Emiel,

      Bovenstaande xsl gaat er vanuit dat de rss feed meerdere “channels” bevat, omdat ik in mijn voorbeeld yahoo pipes heb gebruikt voor het bundelen van meerdere feeds in 1 feed. Wellicht dat daar je probleem vandaan komt. Ik ga er vanuit dat je feeds wel over een “title” en “description” beschikken?

  2. Bedankt voor de code, ik heb nu diverse webparts aangemaakt en al het nieuws vanuit mijn branche komt binnen op 1 pagina.

    Nu wil ik uit al deze webparts het meest nuttige nieuws naar 1 plaats exporteren, is dit mogelijk?

    Ik heb SP foundation 2010, elke hulp is welkom!

    • Beste Mark, geen dank!

      Kun je aangeven wat je bedoeld met “exporteren” van het meest nuttige nieuws?

      Je kunt met bijv. Yahoo Pipes een gecombineerde feed genereren, en die in één WebPart op SharePoint binnen laten komen. Dat is dan op 1 plek.

      Is dat wat je wilt bereiken?

      Gr Rick

      • Bedankt voor de snelle reply.

        Ik heb 8 RSS newsfeeds op een sitepage staan, daarin staat nuttig nieuws en soms waardeloos nieuws. Ik wil de nuttige kunnen selecteren en verplaatsen naar een team discussion list. Dat ik als het ware het goede nieuws eruit filter en kan verplaatsen.

      • Dus feitelijk van webpart naar team discussion list kunnen exporteren/move/copy

      • Dag Mark,

        Voor zover ik weet is dat niet mogelijk. RSS Feeds zijn “read-only”, kun je oppakken en weergeven in een WebPart maar exporteren durf ik zo niet te zeggen. Om dat te kunnen zou je een webpart moeten ontwikkelen.

  3. Hi

    Great piece of coding, thanks 🙂 …but, can I get this to work with SP2010 RSS feeds? I’m trying to get our SP Blog site to feature on our main SP homepage and your code seems to be the best option for us. Is my only option to send the blog to Yahoo Pipes and then bring it back again?

    Also, is there a way I can include dates next to each entry?

    Many thanks,
    Anthony

    • Hi Anthony,

      Yes, this works with SP2010 rss feeds, do you have SP Foundation or Server? If you have server, a default rss viewer WebPart is allready available.

      If you have SP2010 Foundation, you can use my blog post to create a rss viewer WebPart yourself.

      If you have 1 rss feed to display, then there will be no need to use Yahoo Pipes (combines multiple feeds into 1 new feed). Just use the code to get your own rss feed url in and display as you like.

      The dates can be included yes, you need to add the date field to the xml. Depending on how the date field is called, you should add a inside the for each loop.

      Note, if you are planning to add the date field, please have a look at the formatting, google will help you with that.

      Kind regards,

      Rick

  4. Hello,

    I am trying to do this but having a hard time! When i add an XML Viewer webpart, where exactly do I put the rss URL (ours ends in rss).? I see that I put your code in the “XML Editor” section, but where do I put the actual URL?

    Thanks!
    Michelle

Geef een reactie op Mark Reactie annuleren