Skip to main content
Version: Current

RemoveUserFromGroupAsync

Definition

Removes one or more users from the designated group.

C#
public Task<RemoveUserResponse> RemoveUserFromGroupAsync(int groupId, IEnumerable<string> userNames);

Parameters

groupId Int32 The unique identifier of the group from which users will be removed.

userNames IEnumerable<String> A collection of usernames representing the users to be removed from the group.

Returns

Task<RemoveUserResponse>

A task representing the asynchronous operation. The result contains a RemoveUserResponse object that provides details about users who were successfully removed from the group, as well as any users who could not be removed.

Example

C#
using IntelliBuddies.Client;
using IntelliBuddies.Client.Models;

namespace Example
{  
    public class Program
{
        static async Task Main(string[] args)
{
            string serverUrl = "http://demo.onintellibuddies.com";
            string userName = "demo";
            string password = "password";

            using var context = new ControlRoomContext(serverUrl, AuthenticationType.Basic, userName, password);
            context.Open();

            var usersToRemove = new List<string>
{
                "demoUser1",
                "demoUser2"
};

            int groupId = 1;
            var response = await context.Group.RemoveUserFromGroupAsync(groupId, usersToRemove);
}
}
}

Remarks

Use this method to remove multiple users from an existing group in a single call. If the provided user does not exist in the tenant or does not belong to the group, the server will ignore the user, continue removing the following user, and add the ignored user to the failure details.

This API does not operate on usernames that are not part of the group.