AddUsersIntoGroupAsync
Definition
Adds one or more users to the specified group.
C#
public Task<AddUserResponse> AddUsersIntoGroupAsync(int groupId, IEnumerable<string> userNames);
Parameters
groupId Int32
The unique identifier of the group to which users will be added.
userNames IEnumerable<String>
A collection of usernames representing the users to be added to the group.
Returns
A task representing the asynchronous operation. The result contains an AddUserResponse object that provides details about users who were successfully added to the group and those who were not.
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 usersToAdd = new List<string>
{
"demoUser1",
"demoUser2"
};
int groupId = 1;
var response = await context.Group.AddUsersIntoGroupAsync(groupId, usersToAdd);
}
}
}
Remarks
Use this method to add multiple users to an existing group in a single call. If the provided user does not exist in the tenant or the user is already a member of the group, the server will ignore the user, continue adding the following user, and add the ignored user to the failure details.