in Microsoft Teams JavaScript library user.displayname is always empty

Copper Contributor


Using TeamsJS library v2 :

  microsoftTeams.getContext((context) => {
        console.log("microsoftTeams context", context);

But context.user.displayName is always empty. What is wrong?


8 Replies

@vovanb -This is by design behavior. Teams has never returned the displayName in the app context.

So how I can obtain user display name from Teams Tab application?
To be honest I am not happy with your answer - the documentation
show that "user": has "displayName" but it does not says that it will be always empty.
Why if it is not available you return it?
@vovanb -Engineering team considering this as feature request. It will take time to available this publicly so that for workaround they suggest that you can authenticate the user and get their name from the auth token.

We will let you know once we get any update regarding this feature.
Thanks for update, but I disagree that it is a feature, it is sound as bug or wrong documentation. If displayName is a part of schema - why it is empty? If it is always empty then documentation should state it
Thanks for your valuable feedback.
We will check this with engineering team and update the document accordingly.
Whatever it is the feature or bug, I hope we can get user. display name from @microsoft/teams-js; otherwise, it is hard to separate who is.