Пример #1
0
 /// <summary> Remove a member from a thread .</summary>
 /// <param name="user"><see cref="CommunicationUserIdentifier" /> to be removed from the chat thread participants.</param>
 /// <param name="cancellationToken"> The cancellation token to use. </param>
 /// <exception cref="RequestFailedException">The server returned an error. See <see cref="Exception.Message"/> for details returned from the server.</exception>
 public virtual Response RemoveParticipant(CommunicationUserIdentifier user, CancellationToken cancellationToken = default)
 {
     using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ChatThreadClient)}.{nameof(RemoveParticipant)}");
     scope.Start();
     try
     {
         return(_chatThreadRestClient.RemoveChatParticipant(Id, user.Id, cancellationToken));
     }
     catch (Exception ex)
     {
         scope.Failed(ex);
         throw;
     }
 }
 /// <summary> Remove a member from a thread .</summary>
 /// <param name="identifier"><see cref="CommunicationIdentifier" /> to be removed from the chat thread participants.</param>
 /// <param name="cancellationToken"> The cancellation token to use. </param>
 /// <exception cref="RequestFailedException">The server returned an error. See <see cref="Exception.Message"/> for details returned from the server.</exception>
 public virtual Response RemoveParticipant(CommunicationIdentifier identifier, CancellationToken cancellationToken = default)
 {
     using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ChatThreadClient)}.{nameof(RemoveParticipant)}");
     scope.Start();
     try
     {
         CommunicationIdentifierModel communicationIdentifierModel = CommunicationIdentifierSerializer.Serialize(identifier);
         return(_chatThreadRestClient.RemoveChatParticipant(Id, communicationIdentifierModel.RawId,
                                                            communicationIdentifierModel.CommunicationUser,
                                                            communicationIdentifierModel.PhoneNumber,
                                                            communicationIdentifierModel.MicrosoftTeamsUser,
                                                            cancellationToken));
     }
     catch (Exception ex)
     {
         scope.Failed(ex);
         throw;
     }
 }