3
votes

I am trying to create a worksheet using the Graph API and getting the below error. Everything on the URL seems right and I am unable to figure out what is causing the error. There is little help on the Graph API documentation also!

URL: https://graph.microsoft.com/v1.0/me/drive/items/01FUAEYJMWQZF5VGFFL5G27P5AGS5M2FXD/workbook/worksheets

Error: { "error": { "code": "AccessDenied", "message": "Could not obtain a WAC access token.", "innerError": { "request-id": "44990b81-a8ee-489f-9fd8-d5f7c9a31bf1", "date": "2018-05-07T14:02:08" } } }

Microsoft documentation: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/worksheetcollection_add

Any pointers to the solution or what I might be doing wrong is appreciated. Thanks.

1
Welcome to Stack Overflow! Since you're new here, I recommend reading "How do I ask a good question?" for some tips. Please include how your obtaining the token and some sample code showing how you're calling the API. - Marc LaFleur
I had the same error when I was trying to open en XSL file, when I tried with an xlsx it worked fine. - sjkp
Any luck to resolve this issue? - Orange

1 Answers

0
votes

According to this post, "WAC is basically a designation for the Office web apps". So this error probably means that something is tripping up the Graph server (in the file access authentication logic?), but the reported error is not specific enough, hence the generic "WAC Access Token" error.

This worked for me:

  1. Make sure the file is in Sharepoint, not OneDrive (Microsoft Graph doesn't seem to play well with Excel files stored in OneDrive - I think I saw this on Reddit)
  2. Is the file extension .xlsx? (According to this answer, .xltm can cause this error)
  3. Does your user have the Files.Read permission?
  4. Make sure you're using Delegated User permissions from and not Application permissions (GitHub issue)