Microsoft Graph API extending its features across the Microsoft 365 Cloud. One of the features is MS Teams. In this blog, we are going to see how to get the different chat information for different scenarios.
To view the list of chats, we must consent with any one of the below Microsoft Graph API permissions,
- Chat.ReadBasic
- Chat.Read
- Chat.ReadWrite
To get all the chats from the tenant,
Method: Get
https://graph.microsoft.com/beta/chats
Below is the sample screenshot is taken from Microsoft Graph Explorer and this returns all the chats with basic details.
To get all the chats for the current user,
Method: get
https://graph.microsoft.com/beta/me/chats
To get all the chats for the specified user,
Method: Get
https://graph.microsoft.com/beta/users/<User id>/chats
To get only meeting chats for the specified user
Method: Get
https://graph.microsoft.com/beta/users/<User id>/chats?$filter=chatType eq ‘meeting’
To get only the One on One chat for the specified user,
Method: Get
https://graph.microsoft.com/beta/users/<User id>/chats?$filter=chatType eq ‘OneonOne’
To get only the group chats for the specified user
Method: Get
https://graph.microsoft.com/beta/users/<User id>/chats?$filter=chatType eq ‘group’
Leave a Reply