Wednesday 1 September 2010

Wanna use Twitter in SharePoint 2010... sure thing!

Ok so last week I had a golden email off a member of staff:

"Idea to Share:"
"I was thinking I might share my modules on Twitter this year! What do you think?"

I feel my face resembled something similar to this:


Ok maby not quite as excited as the above cat but it was quite close! Why did this excite me so much? Well it basically means I get to use my favourite technology in the WORLD. XML! If I'm honest I barely use xml however its a technology that I respect and realise the awesome power it can possess if used right, and I hoped I could tap into this by combining Twitter and SharePoint!

So here was my plan by using Twitters "Feed for this Query" feature embed the RSS feed into a Tulip page, so that way both staff and students could post information on the SharePoint page provided they use the set Query, this being the module name. BINGO! I also figured giving a link to the academics Twitter account was a suitable idea as well would be useful...

So here's how I did it:

1. Get the RSS feed from Twitter:
Go to Search.Twitter.com and type in the Query name I also added "include:retweets", quite self explanitory what that does.
Then on the search results page:
Click on the link which says "Feed for this query" and it'll bring of the feed (obviously):
However the feed is in ATOM format, which annoyingly isn't supported on our copy of SharePoint, luckily Twitter allows you to change where it says ATOM to RSS and it magically changes to an RSS format... I almost spat my coffee out when I thought "hmm I wonder if I change the URL it'll make it in RSS format". Once you've changed the URL to RSS then copy the whole address.

2. Add the 'RSSFeedForSharePoint' WebPart to your page:
Go to the SharePoint page you want to display your tweets on and click on the edit icon:
We then want to insert a web part this is under "Edit" and "Insert":
THEEEEN To get to the RSSREADER Web Part select "Miscellaneous" - and "RSSReader Web Part" then click "Add":

3. Bring the RSS feed and the reader together:
In your newly added web part go to the bit where it states "Enter the URL of RSS feed" and paste in your XML feed address which we got from step 1:
You can also edit different things in there like how many tweets to show (Enter number of items to display:) and the different sizes etc. Once your happy click "OK". And your tweets should magically appear:
This is all find and dandy but if someone was to visit your page they wouldn't have a clue what they're looking at so lets give it some context. Click on the "edit" button again. And select the area just above where your RSSReader thingy is and Enter some contextual text:
And your done!

This will obviously work for any RSS feed, most notably if you want to use the RSS feed from an individual account, remember to change the ATOM bit to RSS. However I'd advice against displaying your own account here as you might accidently tweet something distasteful to the Module or Program so it's probably best to use the Search Query method I've shown above.

Hope this has been of some use if any of the images are too small click on them to enlarge and please comment if you have any questions or likewise!

2 comments:

Nick Sharratt said...

Nice and simple - I've had a similar twitter feed alongside my work blog showing both my tweets and recently favorited tweets for a long time. From that, one thing to watch for is Sharepoint caching the feed so it doesn't show new tweets straight away despite them being in the RSS feed. I've sometimes had Sharepoint serving a feed that was a few days behind despite it supposedly refreshing every 60mins by default.

Also, just for examples of how this can be just a starting point for the more advanced perhaps, I've used Yahoo pipes to filter the twitter RSS to change links to hyperlinks and @usernames into links to the users page and added the tweet date/time too. (based on a pipe created by someone else to do much more that I simplified down).

:)

Jason Truscott said...

Nice post Stephen, I think its great that you are being asked to develop using these social systems! Don't blame you getting excited. Nice idea to use pipes Nick, for filtering converting content, have been having fun with pipes myself. I think this is the way its going these days. Android app inventor even uses similar visual based programming. All useful tips thanks for sharing :D