public static async Task <IList <ChannelAccount> > GetConversationMembersAsync(this IConversations operations, string conversationId, Dictionary <string, List <string> > customHeaders, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetConversationMembersWithHttpMessagesAsync(conversationId, customHeaders, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// GetConversationMembers /// </summary> /// Call this method to enumerate the members of a converstion. /// /// This REST API takes a ConversationId and returns an array of /// ChannelAccount[] objects /// which are the members of the conversation. /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='conversationId'> /// Conversation ID /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ChannelAccount[]> GetConversationMembersAsync(this IConversations operations, string conversationId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetConversationMembersWithHttpMessagesAsync(conversationId, null, cancellationToken).ConfigureAwait(false)) { return(await _result.HandleErrorAsync <ChannelAccount[]>().ConfigureAwait(false)); } }
public static async Task <TeamsChannelAccount[]> GetTeamsConversationMembersAsync(this IConversations conversations, string conversationId, string tenantId = null) { using (var memberList = await conversations.GetConversationMembersWithHttpMessagesAsync(conversationId).ConfigureAwait(false)) { var members = memberList.Body; return(members.Select(member => member.AsTeamsChannelAccount()).ToArray()); } }
/// <summary> /// Gets teams conversation members asynchronously. /// </summary> /// <param name="conversations">Conversation instance.</param> /// <param name="conversationId">Conversation Id.</param> /// <param name="tenantId">Tenant Id for the conversation.</param> /// <returns>List of members who are part of conversation.</returns> public static async Task <TeamsChannelAccount[]> GetTeamsConversationMembersAsync(this IConversations conversations, string conversationId, string tenantId) { Guid throwawayGuid; if (!Guid.TryParse(tenantId, out throwawayGuid)) { throw new ArgumentException("TenantId should be parseable as a Guid", nameof(tenantId)); } Dictionary <string, List <string> > customHeaders = new Dictionary <string, List <string> >(); customHeaders.Add("X-MsTeamsTenantId", new List <string>() { tenantId }); using (var memberList = await conversations.GetConversationMembersWithHttpMessagesAsync(conversationId, customHeaders).ConfigureAwait(false)) { var members = await memberList.HandleErrorAsync <ChannelAccount[]>().ConfigureAwait(false); return(members.Select(member => member.AsTeamsChannelAccount()).ToArray()); } }