Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft Graph API - Request Photo by size

I'm looking at the Microsoft Graph API Beta for Users/Photo operations documentation and I am comparing it to the Outlook REST API. In the Outlook REST Beta there is the option of retrieving a photo by size.

GET https://outlook.office.com/api/beta/Users('{user_id}')/photos('{size}')/$value

I do not see a way in Graph API to request a photo by size. Is there anyway to do this? If not, is this a planned feature?

like image 790
Brian Kraemer Avatar asked Sep 15 '25 23:09

Brian Kraemer


1 Answers

When using the Microsoft Graph SDK you can do it this way:

var graphClient = GetGraphServiceClient();
var photoStream = await graphClient.Users[userId].Photos["120x120"].Content.Request().GetAsync();

// or

var photoStream = await graphClient.Me.Photos["120x120"].Content.Request().GetAsync()
like image 183
MDummy Avatar answered Sep 17 '25 18:09

MDummy