简体   繁体   中英

MS Teams Get Roster returns "The bot is not part of the conversation roster."

I am trying to fetch the MS Teams roaster / user profile. Below are the sequence of Postman calls I am making:

Generated Access Token: https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token

Generated User Access Token: https://login.microsoftonline.com/ {{TenantId}}/oauth2/v2.0/token Get

My Joined Team: https://graph.microsoft.com/v1.0/me/joinedTeams

Get Internal Team Id: https://graph.microsoft.com/v1.0/teams/ {{TeamId}}/channels

Fetch Roster/user profile:https://{{ServiceUrl}}/v3/conversations/{{tId}}/members/

Everything was working fine, but today I am getting 403 forbidden error

{
    "error": {
        "code": "BotNotInConversationRoster",
        "message": "The bot is not part of the conversation roster."
    }
}

Please note that I am able to communicate with the bot.

Below are the permissions that I have provided for delegate and application Directory.Read.All Group.Read.All Group.ReadWrite.All User.Read User.Read.All User.ReadBasic.All

Any suggestions to fix the same?

Notice that your last call, the one to "serviceurl", is NOT part of the Graph, obviously. As a result, it's authentication is different. In this case, Teams is authenticating it as a bot, and it needs certain rights. For instance, the bot MUST be installed to the Team in question in order to get the roster for that Team. You say it was working before - is that in the same Team? If not, the bot needs to be added to that Team. If "yes", then perhaps the bot was removed from the Team by someone?

You must install your bot as an app in a team before you can call this API. Sending it messages via a webhook does not count. It must be an app installed in the team. Because the bot is retrieving personal information, it needs to be added to that context before the API will work.

See:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM