Getting a group
Log in to add to favouritesRemoving a user from a group can be achieved by using one of the RemoveUser
method overloads on either the group class, or directly from the management client without the need for a group instance.
- RemoveUser(Guid groupId, Guid userId)
- RemoveUserAsync(Guid groupId, Guid userId)
- RemoveUser(User user)
- RemoveUserAsync(User user)
Removes a user from a group.
Syntax
public void RemoveUser(Guid groupId, Guid userId)
{
}
Parameters
groupId
Type: guid
The group identifier to remove the user from.
userId
Type: guid
The user identifier to remove from the group.
Examples
using Zengenti.Contensis.Management;
// Create a client
var client = ManagementClient.Create();
// Mimic a user and group guid
Guid userId = Guid.Parse("3f7e190e-2ea6-4fb2-b0f3-e2ce7a231140");
Guid groupId = Guid.Parse("e65c27e1-211c-4372-874c-458ef28a3e7f");
// Remove the user from the group
client.Security.Groups.RemoveUser(groupId, userId);
Removes a user from a group asynchronously.
Syntax
public async Task RemoveUserAsync(Guid groupId, Guid userId)
{
}
Parameters
groupId
Type: guid
The group identifier to remove the user from.
userId
Type: guid
The user identifier to remove from the group.
Examples
using Zengenti.Contensis.Management;
// Create a client
var client = ManagementClient.Create();
// Mimic a user and group guid
Guid userId = Guid.Parse("3f7e190e-2ea6-4fb2-b0f3-e2ce7a231140");
Guid groupId = Guid.Parse("e65c27e1-211c-4372-874c-458ef28a3e7f");
// Remove the user from the group
await client.Security.Groups.RemoveUserAsync(groupId, userId);
Removes a user from the group using a group and user instance.
Syntax
public void RemoveUser(User user)
{
}
Parameters
user
Type: user
The user to remove from the group.
Examples
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 user
User user = client.Security.Users.Get("t.durden")
// Remove the user from the group
group.RemoveUser(user);
Removes a user from the group using a group and user instance asynchronously.
Syntax
public async Task RemoveUserAsync(User user)
{
}
Parameters
user
Type: user
The user to remove from the group.
Examples
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 user
User user = await client.Security.Users.GetAsync("t.durden")
// Remove the user from the group
await group.RemoveUserAsync(user);