Wednesday, January 13, 2010 #

10 DIY SharePoint Web Parts #10

This post is the tenth and last 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.

#10 - Keep Your SharePoint Calendar Synced with Google

The following is one way you can use to keep your SharePoint Calendar(s) synced up with your Google Calendar.  This particular example only syncs in one direction:  from Google to SharePoint.  It could go the opposite direction, or both, but that's not what I need so that's not what I did.  :)  As usual, this solution requires that you have the RSSBus Web Part installed.  See here for instructions.  You'll also need the GoogleOps Connector, which is automatically included with the RSSBus Web Part.

google.GcalSharePointSync

Step one:  Logon to SharePoint and browse to your calendar.  Under Site Actions, click Edit Page.

Step two:  Now, click on "Add a Web Part", and add the RSSBus Web Part to the page.  I prefer to drag the Calendar up so that it is on top, and this RSSBus Web Part is just below it.  On its edit menu, click Modify Shared Web Part and open the Source Editor.

Step three:  Paste in the following RSSBus Web Part template, and click "Apply".

 
 
 
 
 
<rsb:info title="Google Calendar Sync" description="This template Syncs your SharePoint Calendar events with those in a Google Calendar account.">
  <input name="email" description="The email used to authenticate with Google." required="true"/>
  <input name="password" description="The password used to authenticate with Google." required="true" style="password"/>
  <input name="calendar" description="The SharePoint calendar to sync to." default="Calendar"/>
  <input name="days" description="The number of days to import events for." default="30"/>
</rsb:info>

<rsb:import lib="RSSBus.GoogleOps"/>

<!-- get all the events in the SharePoint calendar -->
<rsb:set attr="list" value="[[calendar]]"/>
<rsb:call op="spListItems" out="myitemout" save="myspitems" >
    <rsb:call op="spGetItem?itemid=[[sp:id]]" >
      <rsb:set attr="myitemout.title" value="[[sp:title]]"/>
      <rsb:set attr="myitemout.location" value="[[sp:location | def('')]]"/>
      <rsb:set attr="myitemout.start_time" value="[[sp:start_time]]"/>
      <rsb:set attr="myitemout.end_time" value="[[sp:end_time]]"/>
      <rsb:set attr="myitemout.description" value="[[sp:description | def('')]]" />
    </rsb:call>
</rsb:call>

<!--get all the events in the Google calendar in the specified range -->
<rsb:set attr="fromdate" value="[[null | date('d')]]"/>
<rsb:set attr="todate" value="[[fromdate | dateadd(day, [[days]]) | todate('d') ]]"/>
<rsb:call op="googleCalSearch" out="mygcalout" save="mygitems">
  <rsb:set attr="mygcalout.title" value="[[ggl:title]]"/>
  <rsb:set attr="mygcalout.location" value="[[ggl:where | def('')]]"/>
  <rsb:set attr="mygcalout.start_time" value="[[ggl:starttime | todate]]"/>
  <rsb:set attr="mygcalout.end_time" value="[[ggl:endtime | todate]]"/>
  <rsb:set attr="mygcalout.description" value="[[ggl:description | def('')]]"/>
</rsb:call>

<!-- now find out what is in google calendar that is not in the sharepoint list, using title and start time as the filter -->
<rsb:set attr="diff.base" value="[[_feeds.myspitems]]"/>
<rsb:set attr="diff.feed" value="[[_feeds.mygitems]]"/>
<rsb:set attr="diff.filter" value="title,start_time"/>
<rsb:set attr="diff.list" value="[[list]]"/>
<rsb:call op="feedDiff" in="diff">
  <!-- for everything not in the sp list, add it!  -->
  <rsb:set attr="name#" value="Title"/>
  <rsb:set attr="name#" value="Location"/>
  <rsb:set attr="name#" value="Start Time"/>
  <rsb:set attr="name#" value="End Time"/>
  <rsb:set attr="name#" value="Description"/>
  <rsb:set attr="value#" value="[[title]]"/>
  <rsb:set attr="value#" value="[[location | def('')]]"/>
  <rsb:set attr="value#" value="[[start_time]]"/>
  <rsb:set attr="value#" value="[[end_time]]"/>
  <rsb:set attr="value#" value="[[description | def('')]]"/>
  <rsb:call op="spAddItem"/>
  <b>[[title]]</b> Successfully imported from Google Calendar.<br>
</rsb:call>
 
 
 

Step four:  After you click Apply, you'll need to specify your Google Calendar email and password, the name of the calendar to sync with (ie, "Calendar"), and the number of days you want it to keep synced at a time.  Optionally, you can embed these inputs into the script if you want, instead of leaving them as web part properties.  To do that, change the rsb:info section of code to this:

<rsb:set attr="email" value="YOUREMAIL" />
<rsb:set attr="password" value="YOURPASSWORD" />
<rsb:set attr="calendar" value="YOURCALENDARNAME" />
<rsb:set attr="days" value="30" />

Now, everytime you view your Calendar page it will automatically be updated with the lastest items from Google Calendar.

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

posted @ Wednesday, January 13, 2010 1:19 PM | Feedback (2)

Tuesday, January 12, 2010 #

PowerShell: Twitter Auto UN-follow

Anybody who uses Twitter has heard of auto-follow services for Twitter.

Below is a PowerShell script I used to auto UNfollow.  The script goes through the people you're following and eliminates "idle" or "spam" friends.  An idle friend is determined by a low friend count or low status count on an account that has been in existance for at least a couple months (configurable).  A spam friend is determined by a high friend count but a low follower count (by default, the script uses a 15-1 ratio as the max).

I would appreciate any good tweaks or improvements you might like to share!  In particular I wasn't sure how to deal with Twitter's rate limiting (150 get requests per hour).  For now I just catch the exception when it occurs and sleep for an hour before resuming.

 
 
 
 
 
#this script goes through the people you're following and eliminates "idle" or "spam" friends.
#an idle friend is determined by low friends or statuses on an account that has been in existance for a while
#a spam friend is determined by high friends but low followers

param([int] $minfriends = 20,
        [int] $minstatuses = 20,
        [int] $minaccountage = 60, #days
        [int] $maxratio = 15,
        [switch] $silent = $false #whether or not to prompt before unfollowing
        )

function unfollow($userid, $userinfo) {
    do {
        Write-Host "Unfollowing User $($userinfo.user.screen_name): $($userinfo.user.friends_count) friends/$($userinfo.user.followers_count) followers/$($userinfo.user.statuses_count) statuses [y/n/l]: " -noNewLine -foregroundColor Yellow
        if ($silent -eq $false) {
            $cmd = Read-Host
        }
        if ($silent -eq $true -or $cmd -eq "y") {
            $wc = new-object net.webclient
            $wc.Credentials = $global:twittercred
            $unfollo = $wc.UploadString("http://www.twitter.com/friendships/destroy/$($userid).xml", "")                
            $unfollow.user.following            
        }
        if ($cmd -eq "l") {
            Start-Process "http://www.twitter.com/$($userinfo.user.screen_name)"
        }
    } while ($silent -eq $false -and $cmd -eq "l")
}

#enter your Twitter credentials for retrieving your friends list
$global:twittercred = Get-Credential

#retrieve the full friends list
$wc = new-object net.webclient
$wc.Credentials = $global:twittercred
$response = [xml]($wc.DownloadString("http://www.twitter.com/friends/ids.xml"))

#now loop through each friend
$response.ids.id | % {
    try
    {
        #get detailed info about this user
        $showuser = [xml]($wc.DownloadString("http://www.twitter.com/users/show.xml?id=$($_)"))
    } catch {
        Write-Host "Twitter rate limit reached (150 gets/hour).  Pausing for one hour..." -foregroundColor Red -noNewLine
        Start-Sleep -Seconds 3600
    }
    #determine if they are worthy of following:
     $datecreated = [DateTime]::ParseExact($showuser.user.created_at, "ddd MMM dd H:mm:ss +0000 yyyy", [System.Globalization.CultureInfo]::InvariantCulture)
     $accountage = ([DateTime]::Now).Subtract($datecreated).Days    
    $statusescount = [int]$showuser.user.statuses_count
    $friendscount = [int]$showuser.user.friends_count
    $followerscount = [int]$showuser.user.followers_count
    if (($accountage -ge $minaccountage) -and ($friendscount -lt $minfriends -or $statusescount -lt $minstatuses)) {
        #unfollow idle friends:
        unfollow $_ $showuser
    }
    elseif (($accountage -ge $minaccountage -and $followerscount -eq 0) -or ($followerscount -gt 0 -and $friendscount / $followerscount -gt $maxratio)) {
        #unfollow spam friends:
        unfollow $_ $showuser
    }    
    else {
        Write-Host "Good friend $($showuser.user.screen_name): $($friendscount)/$($friendscount)/$($statusescount): "
    }
}
 
 
 
Technorati Tags: ,

posted @ Tuesday, January 12, 2010 1:06 PM | Feedback (4)

Tuesday, December 29, 2009 #

Program Files Environment Variable in PowerShell

Today I saw this on Twitter from Julie Blender (@#juneb_get_help): 

Need to reference the "ProgramFiles(x86)" environment variable in #PowerShell? Use ${env:ProgramFiles(x86)}.

I use this in a lot of my scripts, but I want a single variable that contains the right value whether I'm in a 64 bit shell or not.  Here's my solution:

First, I have a function in my testing profile called is64bit, that looks like this:

function is64bit() {
  return ([IntPtr]::Size -eq 8)
}

Next, I have a get-programfilesdir function that I call that checks whether or not I'm in a 64 bit shell or not and returns the appropriate program files environment variable (ie, if I'm running on a 64 bit machine it will return "C:\Program Files (x86)", but if I'm running on a 32 bit machine it will return "C:\Program Files".  If I'm running in a 32 or 64 bit shell on a 64 bit machine, it will always return "C:\Program Files (x86)".

function get-programfilesdir() {
  if (is64bit -eq $true) {
    (Get-Item "Env:ProgramFiles(x86)").Value
  }
  else {
    (Get-Item "Env:ProgramFiles").Value
  }
}

 

Technorati Tags:

posted @ Tuesday, December 29, 2009 7:27 AM | Feedback (1)

GeeksWithBlogs and SubText Bloggers: Input string was not in a correct format

GeeksWithBlogs.net and other SubText Users:

If you are trying to create a new blog post, and you get the following error:

Input string was not in a correct format.    at
System.Text.StringBuilder.FormatError()
   at System.Text.StringBuilder.AppendFormat(IFormatProvider provider,
String format, Object[] args)
   at Subtext.Framework.Util.KeyWords.Scan(String source, String oldValue,
String newValue, Boolean isFormat, Boolean onlyFirstMatch)
   at Subtext.Framework.Util.KeyWords.Format(Entry entry)
   at Subtext.Framework.Data.DatabaseObjectProvider.FormatEntry(Entry e,
Boolean UseKeyWords)
   at Subtext.Framework.Data.DatabaseObjectProvider.Create(Entry entry,
Int32[] categoryIds)
   at Subtext.Framework.Entries.Create(Entry entry)
   at Subtext.Framework.XmlRpc.MetaWeblog.PostContent(String username,
String password, Post& post, Boolean publish, PostType postType)

The problem has been fixed.  It was repoted by Joe Pruitt and fixed by Phil Haack not too long ago.  It was happening for Joe (and me) when attempting to submit a post containing curly braces AND having keywords set up in SubText.  No doubt both Joe and me had this problem due to posting powershell and C# code snippets. 

If you can't get the update yet, you can always just remove your keyword definitions from SubText.  Thats what I did.  :P

posted @ Tuesday, December 29, 2009 4:42 AM | Feedback (1)

10 PowerShell One Liners

Here are a few one-liners that use NetCmdlets. Some of these I've blogged about before, some are new. Let me know if you have questions, which ones you find useful, or how you altered these to suit your own needs.

  1. Send email to a list of recipient addresses:

    import-csv users.csv | % { send-email -to $_.email -from lance@nsoftware.com -subject "Important Email" –message "Hello World!" -server 10.0.1.1 }
  2. Show the access control list for a specific Exchange folder:

    get-imap -server $mymailserver -cred $mycred -folder INBOX.RESUMES –acl
  3. Add look and read permissions on an Exchange folder, for a list of accounts pulled from a CSV file:

    import-csv users.csv | % { set-imap -server -acluser $_.username $mymailserver -cred $mycred -folder INBOX.RESUMES –acl “lr”  }
  4. Sync system time with an Internet time server:

    get-time -server clock.psu.edu –set

    To remotely sync the time on a set of computers:

    import-csv computers.csv | % { Invoke-Command -computerName $_.computer -cred $mycred -scriptblock { get-time -server clock.psu.edu –set } }
  5. Delete all emails from an Exchange folder that match a certain criteria.  For example, delete all emails from alf@email.com:

    get-imap -server $mailserver –cred $mycred | ? {$_.FromEmail -eq alff@email.com} | %{ set-imap -server $mailserver –cred $mycred-message $_.Id -delete }
  6. Update Twitter status from PowerShell:

    get-http –url "http://twitter.com/statuses/update.xml" –cred $mycred -variablename status -variablevalue "Tweeting with NetCmdlets!"
  7. A test-path that works over FTP, FTPS (SSL), and SFTP (SSH) connections:

    get-ftp -server $remoteserver –cred $mycred -path /remote/path/to/checkfor*

    Don't forget the *.  Also, to use SSL or SSH just add an –ssl or –ssh parameter.
  8. List disabled user accounts in Active Directory (or any other LDAP server):

    get-ldap -server $ad -cred $mycred -dn dc=yourdc -searchscope wholesubtree
        -search "(&(objectclass=user)(objectclass=person)(company=*)(userAccountControl:1.2.840.113556.1.4.803:=2))"
  9. List Active Directory groups and their members:

    get-ldap -server testman -cred $mycred -dn dc=NS2 -searchscope wholesubtree -search "(&(objectclass=group)(cn=*admin*))" | select ResultDN, member
  10. Display the last initialization time (e.g. last reboot time) of all discoverable SNMP agents on a network:

    import-csv computers.csv | % { get-snmp -agent $_.computer -oid sysUpTime.0 | %{([datetime]::Now).AddSeconds(-($_.OIDValue/100))} }

Not mentioned here:  data conversion (Yenc, QP, UUencoding, MD5, SHA1, base64, etc), DNS, News Groups (NNTP/UseNet), POP mail, RSS feeds, Amazon S3, Syslog, TFTP, TraceRoute, SNMP Traps, UDP, WebDAV, whois, Rexec/Rshell/Telnet, Zip files, sending IMs (Jabber/GoogleTalk/XMPP), sending text messages and pages, ping, and more.

 

posted @ Tuesday, December 29, 2009 4:36 AM | Feedback (0)

Tuesday, December 08, 2009 #

PowerShell: Smart Parameter Expressions

A while back I posted about how to mark a script parameter as required in PowerShell.  Shortly afterwards, there was some chatter on it that I think makes it worthwhile to add another post on the subject of PowerShell script parameters.

Let’s say you have the question:  “Can I do <X> with a parameter?” 

The answer is probably “Yes”.  :)

Jim and an anonymous emailer both asked:

Is there any way you can specify a parameter based on the value of another parameter?

The answer is yes.  You can put pretty much any expression in the default evaluator of the parameter definition. For example:

 

  param(
    [switch] $switchparam, #an optional "switch parameter" (ie, a flag)
    [string] $user = $(if ($switchparam) { Read-Host -prompt "User"}) #prompt user for value if none provided
  )

In the above example, if –switchparam is specified in the command, the $user parameter default expression will evaluate to true and prompt the user for a user name.

Technorati Tags:

posted @ Tuesday, December 08, 2009 1:49 AM | Feedback (0)

Monday, December 07, 2009 #

Listing SPQuery FieldNameRefs

It took me a while to figure out how to get a list of all the available fields for a particular type of list in SharePoint (for performing custom queries in SPQuery).  I was looking for a published list of these fields, which as far as I know does not exist.  Instead, you just use the GetList method of the Lists SOAP service.  Here’s an example SOAP request:

<?xml version="1.0" encoding="utf-8"?> 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
  <SOAP-ENV:Body> 
    <GetList xmlns="http://schemas.microsoft.com/sharepoint/soap/"> 
      <listName>Private Documents</listName> 
    </GetList> 
  </SOAP-ENV:Body> 
</SOAP-ENV:Envelope>

Just specify the name of the list you want the fields for as the value for the listName input element.

One easy way to work with SharePoint services remotely is by using /n software’s SharePoint Integrator developer toolkit.  Using its SPSite component in Visual Studio I can whip together a few lines of code to consume get the results from the aforementioned service:

spsite1.URL = "http://mysharepoint/mysite/";
spsite1.User = "DOMAIN\lancer";  
spsite1.Password = "password";  
spsite1.DescribeList("Private SharePoint Documents");; 

/n software SharePoint Integrator highlights:

    • Read, Write, and Create SharePoint Lists Items, Documents, and Attachments.
    • Programmatic control of SharePoint Sites, capabilities, and configuration
    • 128-bit strong SSL encryption keeps sensitive transaction information confidential.
    • Small and lightweight components with no dependencies on external libraries.
    • Native development components for all supported platforms and component technologies.
    • Unlimited free Email technical support backed by an experienced & professional staff.
    • Compatible with Microsoft Office SharePoint Server (MOSS), and Windows SharePoint Services v3.0 + (WSS).

 

Technorati Tags: ,

posted @ Monday, December 07, 2009 4:24 AM | Feedback (0)

Monday, November 09, 2009 #

Kayaking on the Deep River

If you know of a better place to take-out of the Deep River at US1, I’d appreciate a note here.  :) Yesterday, my buddy Blake and I went out on a kayak adventure on the Deep River.  “Kayak”, because we took kayaks with us.  “Adventure” because it was very loosely planned and we figured if we ran into any trouble we’d just figure it out and deal with it.  Turned out we did run into some trouble and we did deal with it!  It was a ton of fun! iPhone 007 We knew there was a take-out spot somewhere near the US1 bridge over the Deep River in Chatham County, and we knew there was a put-in spot somewhere near the 15-501 bridge (roughly 7 miles up river).  Unfortunately we couldn’t find an obvious take-out spot…there was one place, but it was below a spillway, and neither of us thought it would be fun to kayak over the spillway.  :)  We ended up driving around searching, but never found a place.  Finally we just decided we’d take-out before the spillway and drag the kayaks out the rest of the way (adventure #1).  Problem was…we’d spend so much time searching that now it was late enough in the day to worry about darkness.  We decided that we could make our way through the woods down the river in the dark with a mini-maglight that Blake had in his car (adventure #2).  :)

With a plan in mind, we put in and headed down the river.  This section of the Deep River is wide, shallow (hah), slow, and rocky.  The river was beautiful, we saw ducks, cool birds, and a river otter that barely escaped our cameras.  It was a slow and steady paddle, with a few minor fast parts that were unfortunately slowed by running into underwater rocks we couldn’t see.

Thankfully we got through one really slow-going rocky part just before dark.  Because it would have taken us forever to get through there in the complete dark.  Whew. 

Now its complete dark.  We got to the spillway and couldn’t find a place to get out, but we’d met a stranger along the way who mentioned that he thought there was a way to paddle around the spillway.  We poked around and saw something, but by this point it was so dark we couldn’t really tell what anything was.  The mini-maglight was no good from more than a few feet away.  Then we saw someone elses flashlight beam ahead – it was the stranger.  They’d found a place to take-out off to the side, but couldn’t paddle around the spillway, unfortunately.

The stranger dragged his kayak out through the woods to a nearby road where he was to be picked up.  We decided to walk around the spillway area and get back in the water somehow.  We may or may not have gotten into some sort of canal that ran alongside the river.  I don’t think we were supposed to be in it, but our options were limited.  We made it down to the US1 bridge, but now we needed to cross the river in order to get out!  In the dark, we managed to somehow climb out of our kayaks onto the steep bank of the canal, walk through the grass and woods to the river, and drop back into the river.  Visibility was about 6 or 7 feet I’d say, which made for a very interesting and spooky paddle adventure.   I said I felt like a native American on a night-time war raid, and he said he felt like a marine.  We decided we were native American marines, or something like that.

Related links:  Deep River Trail – State Trail!
http://www.triangleland.org/news/articles/2007/Powell%20tract.shtml,
http://www.ncparks.gov/News/releases/release.php?id=20

 

posted @ Monday, November 09, 2009 10:42 AM | Feedback (0)

10 DIY SharePoint Web Parts #9

CRMAppointments This post is the ninth 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.

#9 – Microsoft Dynamics CRM

 
CRMContacts The credit for this particular web part template goes to one of my co-workers Shannon Prue.  I asked him if he could put together a MS CRM template example for me, and a few minutes later I had in my inbox a 10 line example template!  In the past, integrating MS CRM with SharePoint meant investing a lot of time, dollars, and ending up with a bunch of rigid complexity.  Not now.  :)  This particular example uses Microsoft CRM Services, but that is not a requirement.

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

Step two, make sure that you have the MscrmOps Connector installed.  Get the service URL for your installation of Microsoft Dynamics CRM (e.g, https://crmserver:5555/mscrmservices/2006/crmservice.asmx) as well as a username and password needed for accessing the service (CRM uses integrated authentication by default, so this will normally be your domain account and password).

Step three, add the RSSBus WebPart to your page, paste the following template into its source editor, edit the serviceurl, username, and password settings to correspond to your own MS CRM instance, and click “Apply”.  You’ll see the web part rendered with a list of contacts from MS CRM.

 
 
 
 
 
<rsb:import lib="RSSBus.MscrmOps"/>
<rsb:set attr="serviceurl" value="http://10.0.1.197:5555/mscrmservices/2006/crmservice.asmx"/>  
<rsb:set attr="username" value="YOURUSERNAME"/>  
<rsb:set attr="password" value="YOURPASSWORD"/>  
<rsb:set attr="maxresults" value="300" />
<rsb:set attr="_meta.YUITableAttrs" value="mscrm:fullname, mscrm:telephone1, mscrm:address1_city"/>
<rsb:set attr="_meta.YUITableLabels" value="Full Name, Phone #, Country"/>  
<rsb:call op="mscrmContact" format="YuiTable" />
 
 
 

That’s it.  If you’ve read the previous 8 DIY articles in this series, you know what' is coming next:  Of course, you can customize this template for your own needs.  This particular template just renders a grid using the YUI (Yahoo UI) Table.  You can do your own html rendering by inserting your own html inside the scope of the <rsb:call>.  You can list other CRM entities, like appointments, leads, contracts, etc.  In fact, I can change the previous example to list CRM appointments by only changing one line of code.  Just replace op=”mscrmContact” with op=”mscrmAppointment”!  You can create pie charts of CRM invoices, bar charts of orders, etc, just by changing the operation call (the op= part) and the html formatting of the data that comes back!

CRMAppointmentsChart


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

Technorati Tags: SharePoint, RSSBus, WebPart, Microsoft Dynamics CRM, CRM.

posted @ Monday, November 09, 2009 10:13 AM | Feedback (0)

Friday, October 30, 2009 #

10 DIY SharePoint Web Parts #8

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 @ Friday, October 30, 2009 3:35 AM | Feedback (0)

Copyright © Lance Robinson

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski