I'm getting an "ErrorAccessDenied" when attempting to get user photos with the Microsoft Graph API v1.0.
I can get a user's information by using
var user = graphClient.Users["userprincipalname"].Request().GetAsync();
And I am also able to use
"https://graph.microsoft.com/v1.0/users/userprincipalname/photo/$value"
In Microsoft's graph explorer to get a user's photo
However when I try to use
var user = graphClient.Users["userprincipalname"].Photo.Content.Request().GetAsync();
I get
{Code: ErrorAccessDenied
Message: Access is denied. Check credentials and try again. Inner error
}
But I'm pretty sure my credentials are correct as I could get all the other information regarding the user. My app is registered in Azure Portal and uses the v1.0 endpoint if that helps.
Any help is appreciated, thanks!