Roland Oldengarm - Independent IT Contractor

Living in the coolest little capital Wellington, New Zealand!

Month: July 2015

Angular ADAL JS + SharePoint REST API in non-root site collections

I’ve been struggling with the following. I’m building a SPA Office Add-in, which communicates with Office 365, using the (awesome) ADAL JS libraries. My app queries the SharePoint Search and downloads files.

As a starting point, I’ve been using this example: https://github.com/OfficeDev/O365-WebApp-MultiTenant

To access the REST API endpoints I was using Angular $http, so I don’t have to worry about adding access tokens to the requests. It was all working fine, until I wanted to access files in non-root site collections. I saw a HTTP/401 in Fiddler, but the access token was attached, so that seemed weird. The response was:

{“error”:”invalid_client”,”error_description”:”Invalid audience Uri ‘{azure_app_id’.”}

… where azure_app_id is my Azure Application ID.

Continue reading

How to get a Yammer Like counter on your page

We have an Office 365 portal and our client wanted to have a Yammer Like button. Alright, that’s easy! Add the Yammer Embed Like and we are done.

The client came back and said: Ah that looks good, but could you also please add the number of likes?
And there is where this blog post is about: Because it’s impossible to get the number of likes, created by the Yammer Like Embed. I have implemented a solution, without a custom database, and is working like a charm. It takes some time though…

Continue reading

How to properly embed a Yammer poll in SharePoint or Office 365

We had the requirement to embed a Yammer poll in SharePoint. This poll would be shown on the homepage of an Office 365 portal. With the Yammer WebPart deprecated, there are two options: Use the REST API, or use the Yammer Embed. We initially tried it with the Yammer Embed, but that is too limited. It only allows to display a certain feed, and has no filter options. The only way to show only one item is to use a Topic feed, and only tag one poll with that Topic. Another showstopper was that we could not apply our styling to the Yammer embed, as it’s hosted in an iframe with no options to style it. It was also annoying that the user had to log in / authenticate every time the browser was closed & reopened.

On the other hand, the REST API has no official documentation around polls. It is possible to retrieve the poll(s), but officially it’s not possible to submit votes. However, I found a solution with the REST API and impersonation with a server-side stored token. This would mean that a user would not have to log in, it would always work.

There are three steps:

  1. Create a Yammer App
  2. Retrieve a test access token as a Yammer Network Admin
  3. Create a SharePoint Provider Hosted add-in, in my case I’ve chosen for MVC.

Continue reading