Tweets in SharePoint – Part 2

In an earlier post I showed how I use the RSSBus SharePoint WebPart to show a list of Twitter search results in your SharePoint pages.  Now I’ll expand on that a bit to show how to make the WebPart a bit more dynamic.

The script of the webpart itself gives a ton of power to the webpart user.  As shown before, each tweet can be formatted however you like.  But we can do so much more, like specifying webpart input properties.  Starting with the same script from last time, here’s how I can make the search query an input property:

  • Click “Modify Shared Web Part”, and “Source Editor…”.
  • Paste in the script from last time, but insert the following at the top:
<rsb:info title="My Search">
<input name="query" desc="The query to send to search.twitter.com" default="SharePoint" />
</rsb:info>

This does two things:  First, it creates a default title for the WebPart itself.  Second, it creates a new input in the SharePoint property editor of the WebPart called “Query”.  Later (not quite yet), when we click “Apply”, look over in the property editor and you’ll see these changes there.

  • Next, we’ll replace the hard-coded search.twitter.com URL with the new dynamic one.  The new URL looks like this: 

    http://search.twitter.com/search.atom?q=[[query]]

    The only difference here is that instead of q=SharePoint, now we have q=[[query]].  This tells the RSSBus WebPart to insert the value of the input property named “query” (the same property we just defined).
  • Now, click “Apply”.  You’ll see the “Query” input in the property editor under the heading “Web Part Inputs”.  It has a default of “SharePoint”, since that is what I used in the rsb:info, but you could use any default you want (or none).  You’ll also see that in the “Appearance” heading, the Title is “My Search”, since that is what I used in the rsb:info.
  • Change the value of the Title to whatever you like, ie “Twitter Search”.  Insert whatever value you like for the Query input, and voila.

We can of course hook this up to a Content Editor WebPart to allow the user to type in their search query in a regular textbox input.  I’ll do that in the next post.

Technorati Tags: , ,

Print | posted on Wednesday, April 22, 2009 11:33 AM

Feedback

No comments posted yet.

Your comment:





 
 

Copyright © Lance Robinson

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski