SOLVED

Teams bot api to fetch the list of all users in a Microsoft tenant

Microsoft

Is there any api to fetch the list of all users available in Microsoft  tenant.

I'm searching for something, similar to mentioned in the link : Fetching the team roaster api, but to get the list of all user in a tenant. 

 

Expected response similar to :

 

 

"id": "29:1GcS4EyB_oSI8A88XmWBN7NJFyMqe3QGnJdgLfFGkJnVelzRGos0bPbpsfJjcbAD22bmKc4GMbrY2g4JDrrA8vM06X1-cHHle4zOE6U4ttcc", 
"objectId": "9d3e08f9-a7ae-43aa-a4d3-de3f319a8a9c", 
"givenName": "Larry", 
"surname": "Brown", 
"email": "Larry.Brown@fabrikam.com", 
"userPrincipalName": "labrown@fabrikam.com"

 

 

3 Replies
best response confirmed by ThereseSolimeno (Microsoft)
Solution

Hi @Sanket26 I would suggest trying the 'List Users' function in Graph, please let me know if this helps resolve your issue. Check out the documentation here:   https://docs.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http

Hi,
I just need the same as you said, I was totatly new to this , I was on google for past 2 days on this how to connect teams bot to Graph api, any help appreciated please.

HI @JordanAlyse 

using the ms graph client /users will return you list of user, however i cant find the ms teams user id (not sure what is the correct term).
which is usually like 29:1XixdnHxkz23iu84OQnc0AuvDQRaKc3Aqd9-m5aVcB2vuac-SIoFza2n1uY_jZqPKkmiVMQ9ASHs3jxjNhJJMgw

in the graph client /users, the user's id is like : ec6e7d43-699f-4660-b0b5-41248642d7ae, which is not the user id that i can use to send proactive message

1 best response

Accepted Solutions
best response confirmed by ThereseSolimeno (Microsoft)
Solution

Hi @Sanket26 I would suggest trying the 'List Users' function in Graph, please let me know if this helps resolve your issue. Check out the documentation here:   https://docs.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http

View solution in original post