GraphAPI - WorksheetProtection: Unprotect Function via Graph API throws CompactToken parsing error: 80049217

Sean-2001 6 Reputation points
2021-04-27T15:24:04.593+00:00

I'm getting an error (CompactToken parsing failed with error code: 80049217) when trying to call the "/protection/unprotect" method on an Excel Worksheet with GraphAPI in both Power Automate Flow & Graph Explorer for testing.

Power Automate Flow gets AccessToken via this method (which works fine): https://laurakokkarinen.com/calling-microsoft-graph-from-microsoft-flow-and-other-daemon-apps-with-delegated-permissions/

The URL I'm testing with looks like:
https://graph.microsoft.com/v1.0/me/drive/root:/test/MYtest.xlsx:/workbook/worksheets/{49875BA4-E169-44A6-8EC5-1374154E60AF}/protection/unprotect

Here are the exports of the POST & Response:

{"log":{"version":"4.0","creator":{"name":"Graph Explorer","version":"4.0"},"entries":[{"startedDateTime":"2021-04-22T12:22:00.650Z","time":160,"request":{"method":"POST","url":"https://graph.microsoft.com/v1.0/me/drive/root:/test/MyTest.xlsx:/workbook/worksheets/{49875BA4-E169-44A6-8EC5-1374154E60AF}/protection/unprotect","httpVersion":"HTTP/1.1","cookies":[],"headers":[{"name":"authorization","value":"Bearer eyJ0eXAiOiJ...........<Access Token is being pasted in from AccessToken on Graph Explorer UI ..............>"},{"name":"accept","value":"application/json"},{"name":"Content-type","value":"application/json"}],"queryString":[{"name":"","value":""}],"postData":{"mimeType":"application/json","text":{"password":"sheetPasswordIncludedHere"}},"headersSize":-1,"bodySize":-1},

"response":{"status":401,"statusText":"Unauthorized","httpVersion":"HTTP/1.1","cookies":[],"headers":{"client-request-id":"c9b966a6-0157-1263-904b-d897b9cafeda","content-type":"application/json","request-id":"1636c6ef-0b64-4409-8097-e6d4d5938994","www-authenticate":"Bearer realm=\"\", authorization_uri=\"https://login.microsoftonline.com/common/oauth2/authorize\", client_id=\"00000003-0000-0000-c000-000000000000\""},"content":{"text":"{\"error\":{\"code\":\"InvalidAuthenticationToken\",\"message\":\"CompactToken parsing failed with error code: 80049217\",\"innerError\":{\"date\":\"2021-04-22T12:22:00\",\"request-id\":\"1636c6ef-0b64-4409-8097-e6d4d5938994\",\"client-request-id\":\"c9b966a6-0157-1263-904b-d897b9cafeda\"}}}","size":268,"mimeType":"application/json"},"redirectURL":"","headersSize":-1,"bodySize":-1},"cache":{},"timings":{"send":0,"wait":0,"receive":0},"connection":""}]}}

Any help would be very much appreciated.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,646 questions
{count} votes