Skip to content

Unable to delete a chat member from another tenant #1111

@chrisbardon

Description

@chrisbardon

Describe the bug
I created a graph application that did the following:
-In tenant A, created a group chat (as user 1), and added user 1 (tenant A) and user 2 (Tenant A) to the chat
-Added user 3 from tenant B by AAD ID to the chat
-Attempted to remove user 3 from the chat using await m_graphClientUser.Chats[m_chatID].Members[memberID].Request().DeleteAsync();

This throws an exception :

Code: NotFound
Message: The requested instance was not found. Id:'MCMjMCMjOGM2YWUxNzItYTNlYS00ZjUwLTk5NGQtYTAyNTY4MjI2OTdmIyMxOTpiNTkyNjYwYzhiMDk0ODJkYTRjODM0ODEwM2ViYjIzMUB0aHJlYWQudjIjIzRhMTJjZmU4LWQ3YzktNGVkMi05NDc4LWMzYzE3ODlmNTFmMQ=='.
Inner error:
	AdditionalData:
	date: 2021-08-20T16:15:47
	request-id: 5a8a9d07-9214-4fc9-be94-c001d255ddf6
	client-request-id: 5a8a9d07-9214-4fc9-be94-c001d255ddf6
ClientRequestId: 5a8a9d07-9214-4fc9-be94-c001d255ddf6

To Reproduce
This is the code I used to remove the user. Note that I'm querying the membership to get the member ID immediately before calling delete:

                string targetID = "4a12cfe8-d7c9-4ed2-9478-c3c1789f51f1"; //aad user ID to remove
                string memberID = null;
                var members = await m_graphClientApp.Chats[m_chatID].Members.Request().GetAsync();
                foreach(var m in members)
                {
                    if (m is AadUserConversationMember && ((AadUserConversationMember)m).UserId.ToLower() == targetID.ToLower())
                        memberID = m.Id;
                }
                if (memberID == null)
                    return;
                await m_graphClientApp.Chats[m_chatID].Members[memberID].Request().DeleteAsync();

Expected behavior
User should be removed from chat. This works if the user is in tenant A, but not if they were added in another tenant.

Desktop (please complete the following information):

  • OS: Win10 19043.1165
  • Microsoft.Graph nuget version 3.35.0
  • Microsoft.Graph.Core nuget version 1.25.1

Additional context
Behaviour is the same whether I'm using application permissions or delegated user permissions to remove the user. Removing user in the same tenant works, cross tenant does not. SDK identifies both as AadUserConversationMember

AB#10802

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions