Error getting thumbnails with app token, works after calling once with user token

Copper Contributor

I'm trying to get thumbnails for new documents in SP online using an app token. This always fails at first. But when calling it once with a user token, it works with the app token. It seems like the graph api only generates the thumbnail when a request is received with a user token.

 

Steps to reproduce:

  1. Generate app token from https://login.microsoftonline.com/{tenantid}/oauth2/token
  2. GET: https://graph.microsoft.com/v1.0/drives/{driveid}/items/{itemid}/thumbnails/. This gives the following response: 
    {
    "error": {
    "code": "UnknownError",
    "message": "",
    "innerError": {
    "request-id": "640819f7-8a64-4e58-bed1-44aeef214859",
    "date": "2018-01-30T10:27:58"
    }
    }
    }
  3. Generate user token
  4. GEThttps://graph.microsoft.com/v1.0/drives/{driveid}/items/{itemid}/thumbnails/ using the user token. This gives a valid response.
  5. GEThttps://graph.microsoft.com/v1.0/drives/{driveid}/items/{itemid}/thumbnails/ using the app token from step 1. Now the response is also valid.

I hope this is not by design? :)

 

0 Replies