Geeks With Blogs

Lance's TextBox » About Me » My Resume »Twitter

TwitterSearchThis post is the eighth 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.

#8 – Twitter

 
Many times since I originally posted about it months ago, I’ve been asked for more details about including Twitter searches and streams inside their SharePoint pages.  Thanks to the Twitter API and feeds, this is very simple to do, and to change from showing searches, mentions, direct messages, or other Twitter streams, all you have to do is use a different RSS or Atom feed to start from.  Here’s what one of mine looks like:

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

Step two, find the RSS or Atom feed URL for the Twitter stream you want to display.  For this example, I’ll show Twitter search results for the keywords “SharePoint” , “PowerShell”, and “RSSBus”.  You can skip the step if you just want to see it work.  When you’re ready to try it with your own search or some other Twitter stream, you’ll need to use your own URL.  If you’re unsure how to get this RSS feed, here are instructions:

Twitter Search: just visit search.twitter.com, perform your search, and look for the “Feed for this query” icon on the top right of the page.
Your Public Timeline:  just visit your profile and look for the “RSS feed of <username>’s tweets” icon on the right side of the page.
Your Twitter Friends Timeline:  just visit your profile and look for the “RSS feed” icon on the bottom right of the page.
Your Twitter Favorites: just visit your favorites page on Twitter and look for the “RSS feed for favorites” icon on the bottom right of the page.
Your Friends Timelines:  just visit your friend’s page and look for the “RSS feed of <friendname>’s tweets” icon on the right side of the page.

Advanced Tip:  you can make your own custom Twitter feeds out of @replies, direct messages, or combined feeds by using the TwitterOps Connector.  With the TwitterOps Connector, you have complete control – you can even send direct messages, send replies, get following and follower lists, or combine two or more of the things into one feed.  If you’re curious about this, give it a shot.  The easiest way to tinker with TwitterOps before importing it into an actual web part is by using the RSSBus Server Admin Console.

Step three, add the RSSBus WebPart to your page, paste the following template into its source editor, and click “Apply”.  You’ll see the web part rendered with the results of the Twitter search results for SharePoint, PowerShell, and RSSBus.

 
 
 
 
<rsb:info title="Twitter Search" >
<input name="SearchPhrase" description="The search phrase to use." def="SharePoint OR PowerShell OR RSSBus"/>
</rsb:info>

<div style="height:60em;width:100%;overflow:auto;padding:10px">
<rsb:call op="http://search.twitter.com/search.rss?q=[[SearchPhrase]]" pagesize="10">
<div style="float:left;background-color:whiteSmoke;margin-bottom:20px">
<div style="float:left;width:40px;margin-bottom:5px">
<a href="[[rss:link]]"><img align="left" src="[[google:image_link]]" border="0" width="33px"/></a>
</div>
<div><a href="[[rss:link]]">[[rss:author]]</a></div>
<div style="color:gray">[[rss:pubDate]]</div>
<div style="float:left;width:100%">[[rss:description]]</div>
</div>
</rsb:call>
</div>
 
 

Step four is to customize this template for your own needs.  If you’ve clicked “Apply” in the source editor of the web part, you should now see a new property appear in the properties editor of the web part in your browser.  Under “Web Part Inputs”, you’ll see a new “SearchPhrase” input.  You can put your own search criteria here.  If you want to forget the search and just show a stream such as your friends timeline, just replace the following line:

<rsb:call op="http://search.twitter.com/search.rss?q=[[SearchPhrase]]" pagesize="10">

with this:

<rsb:call op=”ENTER_YOUR_URL_HERE” pagesize=”10”>

Note the pagesize=”10” – this tells the web part to only show 10 of the items in the feed.  You can change this to whatever value you like, or completely remove it to show all the items.

As always, you can customize the html in the template if you want, or leave it as is.






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

Technorati Tags: SharePoint, RSSBus, WebPart, Twitter

Posted on Friday, October 30, 2009 3:35 AM | Back to top


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

# re: 10 DIY SharePoint Web Parts #8
Requesting Gravatar...
Great post, but there is an easier way - http://www.codingstaff.com/products/sharepoint-web-parts/twitter which I would choose
Left by Sharepoint Developer on Nov 14, 2010 10:03 AM

# re: 10 DIY SharePoint Web Parts #8
Requesting Gravatar...
We are providing two webparts for SharePoint 2007 & SharePoint 2010, one that can be used to show the tweets of any user on the SharePoint portal. Second webpart can be used to post tweet to twitter directly from your sharepoint portal.

http://code.google.com/p/sharepoint-twitter/
Left by Nitin Gupta on Nov 25, 2010 1:01 PM

Your comment:
 (will show your gravatar)


Copyright © Lance Robinson | Powered by: GeeksWithBlogs.net