Share via


ConversationThreadClient.RemoveParticipants Method

Definition

Overloads

RemoveParticipants(String, RemoveParticipantsOptions, CancellationToken)

remove a participant from a conversation.

RemoveParticipants(String, RequestContent, RequestContext)

[Protocol Method] remove a participant from a conversation

RemoveParticipants(String, RemoveParticipantsOptions, CancellationToken)

Source:
ConversationThreadClient.cs

remove a participant from a conversation.

public virtual Azure.Response<Azure.Communication.Messages.RemoveParticipantsResult> RemoveParticipants(string conversationId, Azure.Communication.Messages.RemoveParticipantsOptions options, System.Threading.CancellationToken cancellationToken = default);
abstract member RemoveParticipants : string * Azure.Communication.Messages.RemoveParticipantsOptions * System.Threading.CancellationToken -> Azure.Response<Azure.Communication.Messages.RemoveParticipantsResult>
override this.RemoveParticipants : string * Azure.Communication.Messages.RemoveParticipantsOptions * System.Threading.CancellationToken -> Azure.Response<Azure.Communication.Messages.RemoveParticipantsResult>
Public Overridable Function RemoveParticipants (conversationId As String, options As RemoveParticipantsOptions, Optional cancellationToken As CancellationToken = Nothing) As Response(Of RemoveParticipantsResult)

Parameters

conversationId
String

The conversation ID.

options
RemoveParticipantsOptions

Details of the request body for removing participants from a conversation.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

conversationId or options is null.

conversationId is an empty string, and was expected to be non-empty.

Examples

This sample shows how to call RemoveParticipants.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
ConversationThreadClient client = new ConversationThreadClient(endpoint, credential);

RemoveParticipantsOptions options = new RemoveParticipantsOptions(new string[] { "<participantIds>" });
Response<RemoveParticipantsResult> response = client.RemoveParticipants("<conversationId>", options);

This sample shows how to call RemoveParticipants with all parameters.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
ConversationThreadClient client = new ConversationThreadClient(endpoint, credential);

RemoveParticipantsOptions options = new RemoveParticipantsOptions(new string[] { "<participantIds>" });
Response<RemoveParticipantsResult> response = client.RemoveParticipants("<conversationId>", options);

Applies to

RemoveParticipants(String, RequestContent, RequestContext)

Source:
ConversationThreadClient.cs

[Protocol Method] remove a participant from a conversation

public virtual Azure.Response RemoveParticipants(string conversationId, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member RemoveParticipants : string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.RemoveParticipants : string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function RemoveParticipants (conversationId As String, content As RequestContent, Optional context As RequestContext = Nothing) As Response

Parameters

conversationId
String

The conversation ID.

content
RequestContent

The content to send as the body of the request.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

conversationId or content is null.

conversationId is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call RemoveParticipants and parse the result.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
ConversationThreadClient client = new ConversationThreadClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
    participantIds = new object[]
    {
        "<participantIds>"
    },
});
Response response = client.RemoveParticipants("<conversationId>", content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString());

This sample shows how to call RemoveParticipants with all parameters and request content and parse the result.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
ConversationThreadClient client = new ConversationThreadClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
    participantIds = new object[]
    {
        "<participantIds>"
    },
});
Response response = client.RemoveParticipants("<conversationId>", content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("target").ToString());
Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("innererror").GetProperty("code").ToString());

Applies to