Here is the demo code of a solution I showed at BIWUG. As a reminder, here is what the App does:
- When installed into the Host Web, it creates a corresponding Private Group in your Yammer Network and creates a SharePoint Group “Yammer – [Yammer Group ID]
- It attaches security event receivers to the Host Web group in order to keep your SharePoint Team Site membership in sync with the dedicated Yammer Group. The event receivers only check the membership of the SharePoint group created by the App
- The App ships with an App Part that you can use to display the Yammer Group into SharePoint. You don’t need to configure it as it will automatically detect to which Yammer Group your team site is bound
Caution : for the time being, it doesn’t seem possible to delete a Yammer Group via the REST APIs. Therefore, when you delete the SharePoint Group and/or remove the App from the host web, there is no way to remove the Yammer Group automatically..
[Update 08/2015] this is actually possible to delete a yammer group using the REST API. I didn’t find the endpoint at the time of writing the post but you simply need to create a DELETE request against /…./api/v1/groups/id of the group.json
From a technical point of view, the App makes use of :
- A SQL Azure database to store the App configuration. Whenever the App gets added/removed to/from an Host Web, it stores the Yammer Group ID and the SharePoint Group ID for the given team site
- An Azure Storage Queue to log events
- An Azure Web Site to host SharePoint Remote Event Receivers
- A Yammer App that you must create on your Yammer Tenant to retrieve a ClientID and a Global Admin Token (as explained during my session)
In order to test it, the only absolutely required step is to create a Yammer App and grab the ClientId+GAT. You also need to create a ClientId/ClientSecret in SharePoint and update the web.config file of the remote web. In the demo code, find all occurrences of Your_, these are all the placeholders in which you have to provide your own values.
You can download the code here