Thank you for reaching out. Please find the answer below.
You're trying to read messages from a Teams chat group using Microsoft Graph API. It works when you created the chat, but fails with an "InsufficientPrivileges" error when someone else created it.
This happens because your app doesn't have the right permissions or is using an authentication method that doesn't support reading other users' chats.
What You Should Use
To read messages from group chats or 1:1 chats, use this API:
GET https://graph.microsoft.com/v1.0/chats/{chat-id}/messages
To get the list of chats for a user:
GET https://graph.microsoft.com/v1.0/users/{user-id}/chats
These are the correct endpoints for informal chats. Don’t use the /teams/{team-id}/channels/{channel-id}/messages
endpoint — that’s only for Teams channels.
Fixing the Permissions Issue
If you're building a background app (no user interaction):
- Go to Azure Portal > App registrations > Your App.
- Add application permissions:
-
Chat.Read.All
orChat.ReadWrite.All
- Click “Grant admin consent” to approve these permissions.
-
- Use
ClientSecretCredential
in your code with this scope
var scopes = new[] { "https://graph.microsoft.com/.default" };
This lets your app read chats across the organization — even if the chat was created by someone else.
If you're using InteractiveBrowserCredential:
- This works because it uses delegated permissions.
- The signed-in user must be a member of the chat.
- You need
Chat.Read
orChat.ReadWrite
permissions.
This method is good for testing, but not for background services.
Summary
- Use
/chats/{chat-id}/messages
to read chat messages. - Use
ClientSecretCredential
withChat.Read.All
and admin consent for background apps. - Don’t use
/teams/{team-id}/channels/{channel-id}/messages
for group chats. - Avoid
UsernamePasswordCredential
— it’s unreliable and often blocked.
Helpful References
Let me know if you need any further help with this. We'll be happy to assist.
If you find this helpful, please mark this as answered.