Skip to main content

Add users to groups

Log in to add to favourites

Add user to group

C#
1
2
3
public void AddUser(Guid groupId, Guid userId) { }
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
using Zengenti.Contensis.Management; // Create a client var client = ManagementClient.Create(); // Mimic groupId Guid groupId = Guid.Parse("cea8dc76-a421-453d-be80-515a443679df"); // Mimic userId Guid userId = Guid.Parse("b062fab2-2240-4667-9371-e1f5b9164111"); // Add the user to the group client.Security.Groups.AddUser(groupId, userId);

Add user to group async

C#
1
2
3
public void AddUser(Guid groupId, Guid userId) { }
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
using Zengenti.Contensis.Management; // Create a client var client = ManagementClient.Create(); // Mimic groupId Guid groupId = Guid.Parse("cea8dc76-a421-453d-be80-515a443679df"); // Mimic userId Guid userId = Guid.Parse("b062fab2-2240-4667-9371-e1f5b9164111"); // Add the user to the group await client.Security.Groups.AddUserAsync(groupId, userId);

Add users to group

C#
1
2
3
public void AddUsers(Guid groupId, params Guid[] userIds) { }
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
using Zengenti.Contensis.Management; // Create a client var client = ManagementClient.Create(); // Mimic groupId Guid groupId = Guid.Parse("cea8dc76-a421-453d-be80-515a443679df"); // Mimic userIds Guid userId1 = Guid.Parse("b062fab2-2240-4667-9371-e1f5b9164111"); Guid userId2 = Guid.Parse("eb9e5c65-a068-436c-9586-8cfe57fabf6d"); // Add the users to the group client.Security.Groups.AddUsers(groupId, userId1, userId2);

Add users to group async

C#
1
2
3
public async Task AddUsersAsync(Guid groupId, params Guid[] userIds) { }
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
using Zengenti.Contensis.Management; // Create a client var client = ManagementClient.Create(); // Mimic groupId Guid groupId = Guid.Parse("cea8dc76-a421-453d-be80-515a443679df"); // Mimic userIds Guid userId1 = Guid.Parse("b062fab2-2240-4667-9371-e1f5b9164111"); Guid userId2 = Guid.Parse("eb9e5c65-a068-436c-9586-8cfe57fabf6d"); // Add the users to the group await client.Security.Groups.AddUsersAsync(groupId, userId1, userId2);

Add user from group

C#
1
2
3
public void AddUser(User user) { }
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
using Zengenti.Contensis.Management; // Create a client var client = ManagementClient.Create(); // Get the group Group group = client.Security.Groups.Get("Fight Club Administrators"); // Get the user User user = client.Security.Users.Get("tyler.durden"); // Add the user to the group group.AddUser(user);

Add user from group async

C#
1
2
3
public async Task AddUserAsync(User user) { }
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
using Zengenti.Contensis.Management; // Create a client var client = ManagementClient.Create(); // Get the group Group group = await client.Security.Groups.GetAsync("Fight Club Administrators"); // Get the user User user = await client.Security.Users.GetAsync("tyler.durden"); // Add the user to the group await group.AddUserAsync(user);

Add users from group

C#
1
2
3
public void AddUsers(params User[] users) { }
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
using Zengenti.Contensis.Management; // Create a client var client = ManagementClient.Create(); // Get the group Group group = client.Security.Groups.Get("Fight Club Members"); // Get the users User tyler = client.Security.Users.Get("tyler.durden"); User robert = client.Security.Users.Get("robert.paulsen"); // Add the users to the group group.AddUsers(tyler, robert);

Add users from group async

C#
1
2
3
public async Task AddUsersAsync(params User[] users) { }
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
using Zengenti.Contensis.Management; // Create a client var client = ManagementClient.Create(); // Get the group Group group = await client.Security.Groups.GetAsync("Fight Club Members"); // Get the users User tyler = await client.Security.Users.GetAsync("tyler.durden"); User robert = await client.Security.Users.GetAsync("robert.paulsen"); // Add the users to the group await group.AddUsersAsync(tyler, robert);

Add user from group with user id

C#
1
2
3
public void AddUser(Guid userId) { }
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
using Zengenti.Contensis.Management; // Create a client var client = ManagementClient.Create(); // Get the group Group group = client.Security.Groups.Get("Fight Club Members"); // Mimic a user id Guid userId = Guid.Parse("8243d100-22e8-4f95-bee1-e03ca94c7245"); // Add the user to the group group.AddUser(userId);

Add user from group with user id async

C#
1
2
3
public async Task AddUserAsync(Guid userId) { }
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
using Zengenti.Contensis.Management; // Create a client var client = ManagementClient.Create(); // Get the group Group group = await client.Security.Groups.GetAsync("Fight Club Members"); // Mimic a user id Guid userId = Guid.Parse("8243d100-22e8-4f95-bee1-e03ca94c7245"); // Add the user to the group await group.AddUserAsync(userId);

Add users from group with user ids

C#
1
2
3
public void AddUsers(parmas Guid[] userIds) { }
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
using Zengenti.Contensis.Management; // Create a client var client = ManagementClient.Create(); // Get the group Group group = client.Security.Groups.Get("Fight Club Members"); // Mimic user ids Guid userId1 = Guid.Parse("8243d100-22e8-4f95-bee1-e03ca94c7245"); Guid userId2 = Guid.Parse("9636f573-ea39-48e4-9d2f-6e985f7298bd"); // Add the users to the group group.AddUsers(userId1. userId2);

Add users from group with user ids async

C#
1
2
3
public async Task AddUsersAsync(params Guid[] userIds) { }
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
using Zengenti.Contensis.Management; // Create a client var client = ManagementClient.Create(); // Get the group Group group = await client.Security.Groups.GetAsync("Fight Club Members"); // Mimic user ids Guid userId1 = Guid.Parse("8243d100-22e8-4f95-bee1-e03ca94c7245"); Guid userId2 = Guid.Parse("9636f573-ea39-48e4-9d2f-6e985f7298bd"); // Add the users to the group await group.AddUsersAsync(userId1, userId2);

Add users from group with user string ids

C#
1
2
3
public void AddUsers(parmas string userIds) { }
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
using Zengenti.Contensis.Management; // Create a client var client = ManagementClient.Create(); // Get the group Group group = client.Security.Groups.Get("Fight Club Members"); // Mimic user ids string userId1 = "8243d100-22e8-4f95-bee1-e03ca94c7245"; string userId2 = "9636f573-ea39-48e4-9d2f-6e985f7298bd"; // Add the users to the group group.AddUsers(userId1. userId2);

Add users from group with user string ids async

C#
1
2
3
public async Task AddUsersAsync(params string[] userIds) { }
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
using Zengenti.Contensis.Management; // Create a client var client = ManagementClient.Create(); // Get the group Group group = await client.Security.Groups.GetAsync("Fight Club Members"); // Mimic user ids string userId1 = "8243d100-22e8-4f95-bee1-e03ca94c7245"; string userId2 = "1dfa6915-51d8-4070-9ec1-6bcb7396032b"; // Add the users to the group await group.AddUsersAsync(userId1, userId2);

Still need help?

New support request