Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.

User.Identity.Name returning full name instead of email and photo returning 'ResourceNotFound' #33

Closed
dmundra opened this issue Feb 6, 2019 · 1 comment

Comments

@dmundra
Copy link

dmundra commented Feb 6, 2019

Hi,

When I try the application for 'User.Identity.Name' I get full name instead of email. So I changed the ger users's email line to

email = email ?? User.FindFirst(Startup.UpnType)?.Value;

where
public const string UpnType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn";

For GetPictureStream in the first catch I was getting Request_ResourceNotFound but nothing would happen so I added

else
{
    throw;
}

Then the second catch would work and I got the default image. I am not sure why v1.0 is not returning an image. Any ideas?

@mark-szabo
Copy link
Contributor

Hi @dmundra, sorry for the very late response!

  1. User.Identity.Name contains the username which is not always the email address.

  2. Getting user's profile picture is only partially supported with the v1.0 endpoint:

Note This operation in version 1.0 supports only a user's work or school mailboxes and not personal mailboxes.

https://docs.microsoft.com/en-us/graph/api/profilephoto-get?view=graph-rest-1.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants