How to remove a participant from a Teams call using a bot

Ido Moshe 20 Reputation points
2024-12-25T19:57:55.9333333+00:00

Hi,

I have a Teams recording bot which automatically joins a call via a compliance recording policy (based on the following Microsoft sample: recording bot sample)

I'd like use this bot to remove participants from the call on the fly via Graph API, but I don't manage to remove the following participants:

  1. organizer - I get the following error: "Bot is not authorized to remove organizer in the conversation"
  2. non-recorded participants (e.g. guests) - I get the following error: "Action is invalid, Compliance Recorder can remove only recorded participant."

I'm using the API described in the docs with the required token, my bot has all the relevant graph permissions consented (Calls.AccessMedia.All, Calls.Initiate.All, Calls.InitiateGroupCall.All, Calls.JoinGroupCall.All, Calls.JoinGroupCallAsGuest and more), and I've also applied the PS command to allow my bot to remove participants:

Set-CsApplicationMeetingConfiguration -AllowRemoveParticipantAppIds @{Add="app_id"}

I've also tried doing that from a separate bot (Meeting Notifications bot) and got the same errors.

Is there any way to remove these participants? Do I need other permissions or a completely different type of bot for that?

Thank you!

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
10,554 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,653 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,442 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. LiweiTian-MSFT 22,045 Reputation points Microsoft Vendor
    2024-12-26T01:05:41.6433333+00:00

    Hi @Ido Moshe

    According to the error messages you provided, these two errors are caused by Teams design.

    The error "Bot is not authorized to remove organizer in the conversation" indicates that the Graph API does not allow bots to remove the meeting organizer. This is a built-in restriction to ensure that the organizer, who typically has control over the meeting, cannot be removed by a bot.

    The error "Action is invalid, Compliance Recorder can remove only recorded participant" suggests that compliance recording bots are restricted to interacting only with recorded participants. This is likely a compliance measure to ensure that all interactions by the bot are logged and monitored.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.