Yammer Integration with Sharepoint

26 June 2012

Yammer stands to make an even bigger splash in the Enterprise sector with Microsoft leading it. At Simego we have always developed solutions that allowed IT staff to integrate their systems with ease and Yammer will be no exception. All scenarios DO NOT NEED Yammer Admin permissions

Scenario: Send an update Notification to Yammer when a Status Changes in a SharePoint list

Many IT departments need to notify their users when there are issues with email, file systems, Line-of-Business apps etc. This scenario shows how to connect to Yammer, connect to a SharePoint 'Status Board' and respond to changes in the list by sending a notification to Yammer. Prerequisites:

  • A Yammer account for your service to talk through : systems@yourcomany.com
  • Data Sync Studio Download a 7 day full Version trial
  • SharePoint 2007 & 2010 (Online or On-Premise)
  • MS SQL Express (or any to compare the list for changes).

Step 1: Create a new List in SharePoint similar to the one below

SharePoint

This is essentially a 'Status Board' for the IT Department. Each 'Service' can have the following states:

  • Operating with no issues
  • The service is back up for most, but some users may be experiencing issues
  • We are experiencing a serious problem with this service
  • A small percentage of users are experiencing issues

We want these Status updates to appear in Yammer

Step 2: Open Data Sync and connect to the list created in Step 1

Connect

Step 3: Sync the SharePoint list with a SQL List (Data Sync can create the SQL Table for you)

Data Sync has a feature that left you create a new SQL Table based on the contents of your source. We are going to use that as a target. Create a SQL Table using the wizard from the Tools Menu.

You can now compare the SharePoint List to the SQL Table and Synchronise by pressing the :

Compare A - B

and then

Sync

...this will synchronise all the items in the SharePoint List into the SQL Table.

So, if you change an item in the SharePoint list and then Compare and Synchronise a single update will be make to the SQL Table.

It would be so useful to send that change notification to Yammer!! Luckily for us Data Sync is unbelievable flexible, and uses the .net Framework with a built in development environment to hook into synchronisation events. (Sounds hard but it is automagic).

Step 4: Enable 'Project Automation'

On the 'Project Automation' Tab click on the 'Enable Project Automation' link.

This is the bit that makes or breaks any web based solution like Yammer....Integration.

Step 5: Set up an Application in Yammer

Waltz on over to Microsoft Yammer's application creation page: http://www.yammer.com/client_applications/new and complete the following details obviously replacing your fake name for Simego's!

and you should get a set of OAuth Keys and Secrets:

Yammer

Data Sync has a built in solution for authenticating with Yammer through their standard protocols but it is never going to be plain sailing!

Step 6: Do a Song and Dance to get OAuth working

If Yammer approve 'Data Sync' as a Global Application you will not need to do such a Song and Dance to get all these keys (Hint! Hint!)

We are going to use Data Sync's development environment to do a neat trick for us by doing the OAuth dance and handing out the secure tickets so we can post to Yammer! Back to Data Sync and to the Project Automation editor window. We are now going to use the Consumer Key and Consumer Secret to get a Token Key and Token Secret using DataSync's YammerHelper:

private Simego.DataSync.Providers.OAuth.YammerHelper yammer;   
    
     public override void Start()    
    
     {    
    
     //Configure the helper    
    
     yammer = new Simego.DataSync.Providers.OAuth.YammerHelper(    
    
     "OHdHeOvWcpODC69Q58ecg", //Consumer Key    
    
     "GbXNAYk8YwTTNDal4ZHwo6Pviph0nzJ3hPkhA4v5w"//Consumer Secret    
    
     );    
    
    
    
     //Get the yammer helper to negotiate with Yammer for our OAuth Keys    
    
     Trace.WriteLine(yammer.Authorise());    
    
     }

Click the 'Compare A-B' to start the OAuth negotiation.

Compare A to B

Your web browser will launch and as you to authorise the application (Pro-Tip : If you are not signed in to Yammer then you have to sign-in on this screen)

Click the 'Authorize' button to progress to the next stage. You should be presented with a code number :

Data Sync should have shown you a little dialog to enter this code into:

The magic happens in the background and back on the Data Sync Project Automation page in the bottom of the window Data Sync will be displaying the TokenKey and TokenSecret:

Project Automation

Next we just need to copy those keys next to the Consumer Keys and Secrets and remove the yammer.Authorise() because we have completed the Dance! We can even send a Test Message using the yammer.SendMessage() method!

In Yammer we will see the message:

Step 7: Publish Changes when the Status Changes

All we need to do is add a little code to the 'End' method:

public override void End(ProjectAutomationResult result)  
    
     {   
    
     if ( result.Success && result.HasChanges ) {   
    
    
    
     foreach(var item in result.CompareResult.Updated) {   
    
     yammer.SendMessage(string.Format("{0}, {1}",    
    
     item.SourceRow[3].BeforeColumnValue,    
    
     item.SourceRow[2].BeforeColumnValue));
    
     }   
    
     }   
    
     }

Note: The SourceRow columns are the columns in the Data Sync SharePoint results referenced by number starting with 0.

And we are Done!!

Step 8: Test

To test just update the status of one of your Systems in the SharePoint List and the changes with appear in Yammer:

| |