How to Restrict Microsoft Graph API Chat Access to Only Chats Involving a Specific User (User1)?
Hi Community,
I’m working on a Teams integration using the Microsoft Graph API at the service principal (app-only) level. I’m using the following endpoint to read chat messages:
GET https://graph.microsoft.com/v1.0/chats/{chat-id}/messages
My Goal:
I want to restrict access so that the app can only read messages from chats involving a specific user (User1). For example:
- Chats between User1 and User2
- Chats between User1 and User3
- But not chats between User2 and User3
Current Concern:
Using Chat.Read.All
gives access to all chats in the tenant, which I want to avoid due to security and privacy concerns.
My Questions:
Is there a way to restrict Graph API access to only chats where User1 is a participant?
Can this be achieved using Resource-Specific Consent (RSC) permissions?
Is there any better approach or best practice to meet this requirement securely?
Any help, documentation references, or examples would be much appreciated.
Thanks in advance!