How can I get the thumbnail of a SitePage from SharePoint using the Microsoft Graph Api and App Access Permissions?

0

I need to get the thumbnail for a SitePages from the SitePages library in SharePoint Online. My current approach is to use this URL: https://graph.microsoft.com/v1.0/sites/{siteId}/lists/{listId}/items/31/driveItem/thumbnails/0/large/content

Using the Graph Explorer or Delegated App Access in Postman works great and returns the image. However, using an App Access Token I get an unknown error, that looks something like this:

"error": {
        "code": "generalException",
        "message": "[OneDrive.Media.Streams] e:\\source\\repos\\mediaprocessingcomponents2\\streams\\streamonuriimpl.cpp(647) *** HTTP 500 ***\r\n*** RAWURL ***\r\n{someUrl}?VroomTakeover=1\r\n*** RAWHEADERS ***\r\nHTTP/1.1 500 Internal Server Error\r\nDate: Wed, 29 Apr 2020 12:49:38 GMT\r\nContent-Length: 60\r\nP3P: CP=\"ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI\"\r\nServer: Microsoft-IIS/10.0\r\nSPRequestGuid: 92824d9f-b051-2000-3b6c-f29fd7b02bd4\r\nrequest-id: 92824d9f-b051-2000-3b6c-f29fd7b02bd4\r\nMS-CV: n02CklGwACA7bPKf17Ar1A.0\r\nStrict-Transport-Security: max-age=31536000\r\nX-FRAME-OPTIONS: SAMEORIGIN\r\nSPRequestDuration: 82\r\nSPIisLatency: 4\r\nX-Powered-By: ASP.NET\r\nMicrosoftSharePointTeamServices: 16.0.0.20015\r\nX-Content-Type-Options: nosniff\r\nX-MS-InvokeApp: 1; RequireReadOnly\r\n\r\n*** RAWBODY:\r\n{\"error\":{\"code\":\"itemNotFound\",\"message\":\"Item not found\"}}\r\n*** END *** 0x80004005 Unspecified error.\r\n[OneDrive.Media.Streams] e:\\source\\repos\\mediaprocessingcomponents2\\streams\\streamonuriimpl.cpp(647) *** HTTP 500 ***\r\n*** RAWURL ***\r\n{someUrl}?VroomTakeover=1\r\n*** RAWHEADERS ***\r\nHTTP/1.1 500 Internal Server Error\r\nDate: Wed, 29 Apr 2020 12:49:38 GMT\r\nContent-Length: 60\r\nP3P: CP=\"ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI\"\r\nServer: Microsoft-IIS/10.0\r\nSPRequestGuid: 92824d9f-9056-2000-3b6c-f99db5edd229\r\nrequest-id: 92824d9f-9056-2000-3b6c-f99db5edd229\r\nMS-CV: n02CklaQACA7bPmdte3SKQ.0\r\nStrict-Transport-Security: max-age=31536000\r\nX-FRAME-OPTIONS: SAMEORIGIN\r\nSPRequestDuration: 107\r\nSPIisLatency: 0\r\nX-Powered-By: ASP.NET\r\nMicrosoftSharePointTeamServices: 16.0.0.20015\r\nX-Content-Type-Options: nosniff\r\nX-MS-InvokeApp: 1; RequireReadOnly\r\n\r\n*** RAWBODY:\r\n{\"error\":{\"code\":\"itemNotFound\",\"message\":\"Item not found\"}}\r\n*** END *** 0x80004005 Unspecified error.\r\n[OneDrive.Media.Streams] e:\\source\\repos\\mediaprocessingcomponents2\\streams\\streamonuriimpl.cpp(647) *** HTTP 500 ***\r\n*** RAWURL ***\r\n{someUrl}?VroomTakeover=1\r\n*** RAWHEADERS ***\r\nHTTP/1.1 500 Internal Server Error\r\nDate: Wed, 29 Apr 2020 12:49:38 GMT\r\nContent-Length: 60\r\nP3P: CP=\"ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI\"\r\nServer: Microsoft-IIS/10.0\r\nSPRequestGuid: 92824d9f-4065-2000-3b6c-faec5e984212\r\nrequest-id: 92824d9f-4065-2000-3b6c-faec5e984212\r\nMS-CV: n02CkmVAACA7bPrsXphCEg.0\r\nStrict-Transport-Security: max-age=31536000\r\nX-FRAME-OPTIONS: SAMEORIGIN\r\nSPRequestDuration: 63\r\nSPIisLatency: 0\r\nX-Powered-By: ASP.NET\r\nMicrosoftSharePointTeamServices: 16.0.0.20015\r\nX-Content-Type-Options: nosniff\r\nX-MS-InvokeApp: 1; RequireReadOnly\r\n\r\n*** RAWBODY:\r\n{\"error\":{\"code\":\"itemNotFound\",\"message\":\"Item not found\"}}\r\n*** END *** 0x80004005 Unspecified error.\r\n[OneDrive.Media.Streams] e:\\source\\repos\\mediaprocessingcomponents2\\streams\\streamonuriimpl.cpp(1695) The stream is in a fatal error state and can no longer be used. 0x80004005 Unspecified error.\r\n[OneDrive.Media.Streams] e:\\source\\repos\\mediaprocessingcomponents2\\streams\\streamonuriimpl.cpp(1563) 0x80004005 Unspecified error.\r\n[OneDrive.Media.Streams] e:\\source\\repos\\mediaprocessingcomponents2\\streams\\streamonuriimpl.cpp(1988) 0x80004005 Unspecified error.",
        "innererror": {
            "code": "Web_500InternalServerError"
        }
    }

I already checked the Azure App Permissions and all required (Files.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All) are granted for the application. See roles after decoding the token:

 "roles": [
    "Sites.Read.All",
    "Sites.ReadWrite.All",
    "Files.ReadWrite.All",
    "User.Read.All",
    "Files.Read.All"
  ]

Does anyone have an idea where I'm missing something?

microsoft-graph-api
azure-ad-graph-api
microsoft-graph-files
asked on Stack Overflow Apr 29, 2020 by Alex S • edited May 4, 2020 by Alex S

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0