GRAPH: Retrieve Image from Microsoft List via Graph

Jens Krengel 0 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 Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,051 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,011 questions
{count} votes