Open sugargx opened 6 months ago
Hi @sugargx, thanks for reporting this. Can you please share in which host you're seeing this issue (old Teams, new Teams, Outlook, etc.)? While we investigate a fix, you may consider the workaround specified in this issue as well.
Hi @jekloudaMSFT, thanks for your rapid response. According to our tests involved, the issue can be reproducible in the old Teams and new Teams platform. As for other platform, we are not involved with the other, so we don't know if they can be reproduced.
Hi @jekloudaMSFT, thanks for providing the same issue, and based on the above issue discussion, are we to understand that this display name field is not supported in the Teams platform/host util now? So we need to get this property value in some other way, like fetch the user token by calling getAuthToken() and then parse the token or call the Grpah API to get the data, right?
Hi @sugargx, thanks for the additional details. I tried testing this in my own app and was able to retrieve the user displayName with getContext
. Is it possible that the account used to test this does not have an associated displayName
? Per the documentation, this value may be returned as undefined
.
Hi @jekloudaMSFT, thanks for your reply. May I ask if you tested this in the Teams app?
And what is the best way to determine if a user has a display name of their own? I can confirm that it is available by parsing the test user's token to get the name from it, is there any other way to confirm this? Seems like the user.displayname
by call getContext
origin from user info setting.
I tested this on new Teams. It might be easiest to try to get the displayName through graph explorer: https://developer.microsoft.com/en-us/graph/graph-explorer. Can you try hitting https://graph.microsoft.com/v1.0/me
while signed in with the account you're using to test this?
Hi @jekloudaMSFT, I can also get the display name login with the test user account by calling the graph API, which is the consistent value by parsing the JWT token. But, for display name from the getContext
, it doesn't work well.
Is it possible to understand that Teams does not have strong support for this attribute? So, we need to get this property value in some other way, like call the Grpah API to get the data or fetch the user token by calling getAuthToken()
and then parse the token.
Thanks for checking! Yes, I believe that may be the case. I'll raise this issue with Teams, but in the meantime you may rely on the Graph API or user token to get this info.
Thanks @jekloudaMSFT for your all patience response! We will continue to use other 2 ways to fetch the user display name. And If you post an issue for Teams, can you share it here? This will allow us to track progress and make adjustments to our code. Thanks a lot!
Hi @jekloudaMSFT, any progress on this issue?
Hi @rickygao, I'm following up with Teams to see what the status of this is. I'll share an update shortly
Hello team,
We try to call
getContext()
SDK to fetch context data, include user data. But, we found that theuser.displayname
value is undefined as the below image:Both in the code and in the documentation, we can see that this property is defined. But there is no valid value, even though the user has a valid token.
Could you please provide more insight and help the issue? thanks very much.