Forum Discussion
Teams tab: Authentication to call Graph API
1. If you want to fetch the list of users in a team you can directly use the bot context for that, you do not need to do a graph API call for that.
2. Yes, you could use this method when your app has application permissions. Getting access token without a user requires the admin of your tenant to give a one-time consent to your application. Your application can then do the graph api calls, it is permitted to, without the user.
- diegoSpaceJan 22, 2020Brass Contributor
Thanks for your response. I changed from 'ActivityHandler' to 'TeamsActivityHandler' and I get the members of the chat where I receive a message.
But it is possible in the bot using TeamsInfo with the context of the incoming message, isn't it? Can I get all the users of Teams client from the bot without this received message? I need to list all Teams users in my tab page. Now I get the list calling the Graph API from bot code, when I receive a custom request from tab code.
Where can I find TeamsInfo docu?
And another doubt, can I get the Teams userId and the chat Idin tab context? About the userId, I can only see the 'userObjectId', which is the Azure user id. About the chatId, there is a value in tab context but it is empty...
I would need to know these values in my tab page, to call my bot code and do things with them... In my bot I manage users with the Teams userId, and I need it for instance to create a new one2one chat ('connectorClient.conversations.createConversation(...)').
Thanks,
Diego- Gousia_BegumJan 30, 2020Former Employee
diegoSpace In order to get the list of users in a team inside a tab, you will need to make a Graph API call from the tab. Tab context does not allow you to fetch the details of all the members in a team. Please refer this document to see what are the different values tab context has.
- diegoSpaceJan 31, 2020Brass Contributor
Gousia_Begum Thanks