I’ve got lot of additional questions on Yammer and SharePoint integration after I wrote the blog post on getting started on building social intranets with SharePoint and Yammer back in March. One of the most asked questions is that how could the out of the box team site feed be replaced automatically with Yammer feed. This is actually something what we have been showing in the Office AMS samples (Solutions\Provisioning.Cloud.Sync) quite a while, with Yammer contributions for that one done by Richard diZerega.
As part of the latest July release of the Office AMS, we included slightly more simplified version of the Yammer integration demo and some reusable code to the Office AMS core component to make this process as easy as possible. You can find this sample code from the latest version of the Office AMS package at path Scenarios/Provisioning.Yammer. Main parts of this code were contributions from Sami Nieminen (Senior Consultant, Microsoft) based on the work what Richard had done previously.
Scenario sample in Office AMS shows how to replace the out of the box site feed with Yammer feed using few different options. In Yammer we can create groups, associate to existing ones or we can also take advantage of so called OpenGraph feeds, which can be created for any object or URL. Officially we encourage to use the OpenGraph option for site feeds, since you really don’t want to create one Yammer group for each SharePoint collaboration sites. This would simply cause massive pollution of yammer groups in your network and end users could not easily locate the needed social connections which are vital for their work.
To be able to execute the code, you’ll need to register or acquire access token for app. This means that you register app to your Yammer network which can than work on behalf of users and replace the out of the box site feed asynchronously during site provisioning. You can follow the steps defined in Yammer developer guidance.
You can control the used access token from web.config in provider hosted web by updating following key.
Demonstration of the functionality
This is how things looks in practice also in picture format when you execute the code (Office AMS package – Scenarios/Provisioning.Yammer). Following picture shows how the provider hosted app UI when you start creating sub sites. In the Office AMS samples we are also showing how to replace the out of the box sub site creation experience with the provider hosted app (same Solutions/Provisioning.Cloud.Sync sample), but this particular sample is just mock up so you can access this UI normally from the site content view of the site. Regardless how you access the functionality, remember that we can certainly execute the code for example during the initial site collection creation, so that each collaboration site has Yammer feeds by default in them rather than out of the box SharePoint site feed.
So here’s a user experience on the default settings after we have used OpenGraph option. Usage of group option will result pretty much identical rendering structure.
And here’s the UI from the Yammer side showing the discussion from the particular site in the OpenGraph structure. Provisioning is also configuring orange branding for the site to demonstrate how easily that can be changed during the site creation.
Show me the code
Since this code is using reusable Office AMS core component, actual provisioning, branding and yammer logic is only few lines of code. This is exactly the purpose of the Office AMS core component, so that you don’t need to write the same logic all over again. Most of the Office AMS core component code is exposed as extensions to out of the box CSOM objects like the CreateSite method for the Web object, which is create new sub site for the particular Web object as a single line of execution.
As you can see from above code, we resolve the YammerUser object regardless of the feed type. This is used to get the network name for the used access token dynamically, but you could simply also hardcode the network name for the OpenGraph option, which would remove the need to use the Yammer access token in first place.
Here’s how the GetYammerOpenGraphDiscussionPart method looks like. In this method we just create generic web part object, which is then actually defined in xml format.
Actual web part definition is parsed as followed to xml format and injected to the site welcome page. Not the most elegant way, but does work and we provide different options which can be controls for the parsing, like are we showing the header or footer of the feed.
For the other details, you can easily download the Office AMS package and have a look on the code or debug the code while executing it against Office365 tenant.
Summary and References
As you can see from the code, this is pretty simple process. Someone might ask why isn’t Microsoft doing this by default for Office365, which is absolutely valid question and this could happen in future. Right now however there’s no confirmation on getting this natively for team sites and it might be that it’s not something what is not coming in future either specifically fro the team sites. We have however released lot of information already back in SharePoint Conference 2014 on some of the additional Yammer integration tooling which is coming sooner or later. You might want to check the Office365 roadmap for details on the concentration areas in development.
One side of the story is also the on-premises deployments which we could not automatically associate to Yammer anyway, since there would be no certainty that the customer would have Yammer available, so therefore this cannot happen by default at least in on-premises setup. This blog post is however showing how writing only few lines of code or taking advantage of the Office AMS community project, you can have this capability for your sites easily for Office365 or for on-premises deployments.
Here’s also some generic links on covered topics in this blog post.
- Office AMS community project for getting the showed code
- Getting started on building social Intranet’s with SharePoint and Yammer
- Steve Peschka’s notes on .NET and Yammer integration
- Yammer development documentation
Please do give us input on the provided examples with the Office AMS package. Your feedback is highly appreciated and if there’s something what we are missing, just let us know.