Forum Discussion
❓ Can't remove member from Microsoft Teams Group Chat using Graph API with Application Permission
Hi everyone,
I’m currently working on creating a Teams group chat using Microsoft Graph API with application permissions, and I’ve run into several issues that I hope someone here can help clarify.
Creating group chat with members and installed app (works)
I followed the documentation here:
“Create a one-on-one chat with installed apps”
➜ https://learn.microsoft.com/en-us/graph/api/chat-post?view=graph-rest-1.0&tabs=http#example-3-create-a-one-on-one-chat-with-installed-apps
Using application permissions, I successfully:
- Created a group chat
- Added multiple members
- Installed my Teams app into the chat automatically
My application has already been granted the following permissions:
ChatMember.ReadWrite.All
ChatMember.ReadWrite.WhereInstalled
The purpose is to allow the app to add or remove chat members without requiring a signed-in user, since I am using fully non-delegated application permissions.
However, when I try to remove a member from the group chat using Graph API with the application token, the request fails and returns an error.
Trying RSC-granted approach – app not installed
Next, I tried creating a group chat using the RSC-granted app approach:
https://learn.microsoft.com/en-us/graph/api/chat-post?view=graph-rest-1.0&tabs=http#example-4-create-a-one-on-one-chat-with-rsc-granted-apps
With the following permission:
- ChatMember.ReadWrite.All
And permission type: application
The group chat is created successfully, but the app is not installed inside the chat, which means I still can’t proceed with removing a member using the app context.
So this solution also stops midway.
Creating chat first, then installing the app (also fails)
Lastly, I attempted another method:
Create the group chat normally
After creation, install the app into it using this endpoint:
https://learn.microsoft.com/en-us/graph/api/chat-post-installedapps?view=graph-rest-1.0&tabs=http
I used an application access token again, but the request returns the same error as case #1 when attempting to remove a member.
1 Reply
- Sayali-MSFT
Microsoft
Hello Haekal_Arif_Rozikin,Thank you for bringing this issue to our attention. We will look into it and get back to you shortly.