I want to retrieve all users in my Azure Active Directory with their profile photo.
My request looks like this:
var photo = await _graphServiceClient.Users[userId].Photo.Content.Request().GetAsync()
I know that it is theoretically possible to define the desired size: Microsoft Graph API - Get profile picture with defined size
Now I'm wondering how to do that in C#. I know that it actually works like this for groups:
var photo = await _graphServiceClient.Groups[groupId].Photos["64x64"].Content.Request().GetAsync()
If I'm using the brackets in my user request, it says "Cannot apply indexing...".
var photo = await _graphServiceClient.Users[userId].Photo["64x64"].Content.Request().GetAsync()
I hope someone can help :)
CodePudding user response:
Probably you need Photos
not Photo
var photo = await _graphServiceClient.Users[userId].Photos["64x64"].Content.Request().GetAsync()