GRAPH: Retrieve Image from Microsoft List via Graph

Jens Krengel 5 Reputation points
2024-06-05T10:53:44.1833333+00:00

Hello,

I have integrated a Microsoft list with Graph. I can read and write List Items. I am also seeing the field "DevicePhoto" while retrieving the items of the list:

"DevicePhoto": "{\"type\":\"thumbnail\",\"fileName\":\"name.jpg\",\"nativeFile\":{},\"fieldName\":\"DevicePhoto\",\"serverUrl\":\"https://name.sharepoint.com\",\"fieldId\":\"...\",\"serverRelativeUrl\":\"/sites/.../SiteAssets/Lists/.../name.jpg\",\"id\":\"...\"}",

If i assemble the url from serverUrl and serverRelativeUrl I can view the image via an authenticated browser. However, when I request this url via eg. postman with my AccessToken I get 401 unauthorized.

I am creating my AccessToken with the following permissions (openid profile offline_access Chat.ReadWrite User.Read.All ChannelMessage.Send ChannelMessage.Read.All Team.ReadBasic.All Channel.ReadBasic.All Channel.create Team.Create TeamMember.ReadWrite.All GroupMember.Read.All Group.Read.All Sites.ReadWrite.All Calendars.ReadBasic)

I also tried to reach for the drive where the images are stored but I cannot access the one with the siteAssets.

What is the best way to query the DevicePhoto from an App registration?

Thank you very much for your help!!

Jens

Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft Security | Microsoft Graph
{count} vote

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.