public static async Task RemoveChannelMembers(Beta.GraphServiceClient client, string teamid, string channelid, IList <Beta.AadUserConversationMember> members, bool ignoreNotFound, CancellationToken token)
        {
            if (members.Count == 0)
            {
                return;
            }

            Dictionary <string, Func <BatchRequestStep> > requests = new Dictionary <string, Func <BatchRequestStep> >();

            foreach (var member in members)
            {
                requests.Add(member.Id, () => GraphHelper.GenerateBatchRequestStep(HttpMethod.Delete, member.Id, client.Teams[teamid].Channels[channelid].Members[member.UserId].Request().RequestUrl));
            }

            logger.Trace($"Removing {requests.Count} members in batch request for channel {teamid}:{channelid}");
            await GraphHelper.SubmitAsBatches(client, requests, ignoreNotFound, false, token);
        }
Exemple #2
0
        public static async Task RemoveGroupOwners(GraphServiceClient client, string groupid, IList <string> members, bool ignoreNotFound, CancellationToken token)
        {
            if (members.Count == 0)
            {
                return;
            }

            Dictionary <string, Func <BatchRequestStep> > requests = new Dictionary <string, Func <BatchRequestStep> >();

            foreach (string member in members)
            {
                requests.Add(member, () => GraphHelper.GenerateBatchRequestStep(HttpMethod.Delete, member, client.Groups[groupid].Owners[member].Reference.Request().RequestUrl));
            }

            logger.Trace($"Removing {requests.Count} owners in batch request for group {groupid}");
            await GraphHelper.SubmitAsBatches(client, requests, ignoreNotFound, false, token);
        }