Forum Discussion

Paul_By's avatar
Paul_By
Brass Contributor
Nov 08, 2021

MS Team. Bot. TeamsInfo.GetMemberAsync returns 'Forbidden'

Hi. 

Bot handles "Messaging Extension Query activity" (OnTeamsMessagingExtensionQueryAsync) request.

One by One chat (My User - User 1).

I need to know "My User" email address. I use 

await TeamsInfo.GetMemberAsync(turnContext, userId, cancellationToken);

Chat:

- "Bot - My User" works. 

- "My User - User 1" 'Forbidden' ("message\":\"The bot is not part of the conversation roster.\")

- "My User - User 2" works.

1) What's the reason? Are there any limitations? 

2) Maybe there is additional way to get "my" account (email address , domain name)?

3) Are there any ways to put into cache the current user (loged in Teams) email address?

I need to know the email address (user domain name) in each action (activity).

 

 

  • Paul_By's avatar
    Paul_By
    Nov 08, 2021
    Workaround: I get 'TeamsChannelAccount' data (TeamsInfo.GetMemberAsync(...)) in "Bot-User" conversation (first step) and put it into 'UserState'. Then I can get and use it.
    My Bot: "scopes": ["personal"]. Maybe this is the reason of the issue.
    • Paul_By's avatar
      Paul_By
      Brass Contributor
      Workaround: I get 'TeamsChannelAccount' data (TeamsInfo.GetMemberAsync(...)) in "Bot-User" conversation (first step) and put it into 'UserState'. Then I can get and use it.
      My Bot: "scopes": ["personal"]. Maybe this is the reason of the issue.

Resources