Pages Menu

Posted by on May 16, 2022 in Development, Microsoft Teams

Microsoft Teams apps can now get a list of chats for a user, using just Application Permissions

Microsoft Teams apps can now get a list of chats for a user, using just Application Permissions

Exciting news for Microsoft Teams developers. New updates to the Microsoft Graph REST API have made it possible for an application to list and retrieve chats a user is a member of… without needing to have the user sign-in.

Previously (and today in the v1.0 namespace) calls made to the /users/{user-id | user-principal-name}/chats endpoint – which is used to obtain a list of chat IDs the user is participating in – required Delegated permissions. This means that the user needed to be present and signed in, with the app using the identity of the user to perform the action.

That’s all changed in the beta namespace now, however, because new Application permissions are listed in the documentation. Application permissions do not require the user to be present and mean that an application with these permissions can perform a search for any user in the tenant. This makes them ideal for back-end utility programs that run headless rather than on user command (as they don’t require the user to be there).

Applications will require one of Chat.ReadBasic.All, Chat.Read.All, Chat.ReadWrite.All.

The resulting list contains a good deal of information about the chat session but, having obtained a list of chat IDs it’s good to know that the follow-up call to get more detail about each chat already supports Application permissions.

I see this being a good enhancement for any applications that perform auditing or monitoring of which users are talking to which other users, or for snapshotting the “current state” of a user, perhaps for backup.

Written by Tom Morgan

Tom is a Microsoft Teams Platform developer and Microsoft MVP who has been blogging for over a decade. Find out more.
Buy the book: Building and Developing Apps & Bots for Microsoft Teams. Now available to purchase online with free updates.

Post a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.