Forum Discussion

TCM001's avatar
TCM001
Copper Contributor
May 03, 2023

Failed to execute backend request using Remove-MgChatMember

PowerShell ISE and 7.0

Remove-MgChatMember -ChatId string -ConversationMemberId string

fails with : Remove-MgChatMember : Failed to execute backend request.

 

+ CategoryInfo : InvalidOperation: ({ ChatId = 19:8...=, IfMatch = }:<>f__AnonymousType215`3) [Remove-MgChatMember_Delete], RestException`1+ FullyQualifiedErrorId : InternalServerError,Microsoft.Graph.PowerShell.Cmdlets.RemoveMgChatMember_Delete

 

ChatId should be correct as returned from get-MgUserChat, so I don understand why its failing.
Anyone have an idea?

  • _CM_'s avatar
    _CM_
    Copper Contributor
    Tested as per: https://learn.microsoft.com/en-us/graph/api/chat-delete-members?view=graph-rest-1.0&tabs=http

    connect-mgGraph -scopes "ChatMember.ReadWrite" (successful)

    Remove-MgChatMember -ChatId somthing@thread.v2 -ConversationMemberId rather_long_string

    now returns:
    Remove-MgChatMember : InsufficientPrivileges

    + CategoryInfo : InvalidOperation: ({ ChatId = 19:8...=, IfMatch = }:<>f__AnonymousType229`3) [Remove-MgChatMember_Delete], RestException`1 + FullyQualifiedErrorId : Forbidden,Microsoft.Graph.PowerShell.Cmdlets.RemoveMgChatMember_Delete

    I initially used an AAD app registration with all the Delegated and Apprlication permissions for Chat and more, all being consented for organization, failing with the initial error in first post.

    Could this all be caused of the Graph API protection? https://learn.microsoft.com/en-us/graph/teams-protected-apis

Resources