Suspend or Unsuspend a user account
Log in to add to favouritesSuspending or Unsuspending a user's account can be achieved by calling one of the following methods on the user object.
- Suspend()
- SuspendAsync()
- Unsuspend()
- UnsuspendAsync()
Syntax
public void Suspend()
{
}
public async Task SuspendAsync()
{
}
public void Unsuspend()
{
}
public async Task UnsuspendAsync()
{
}
Examples
Suspend a user synchronously.
using Zengenti.Contensis.Management;
// Create a client
var client = ManagementClient.Create();
// Get the user
User user = client.Security.Users.Get("t.durden");
// Suspend the user
user.Suspend();
Suspend a user asynchronously
using Zengenti.Contensis.Management;
// Create a client
var client = ManagementClient.Create();
// Get the user
User user = client.Security.Users.Get("t.durden");
// Suspend the user asynchronously
await user.SuspendAsync();
Unsuspend a user synchronously.
using Zengenti.Contensis.Management;
// Create a client
var client = ManagementClient.Create();
// Get the user
User user = client.Security.Users.Get("t.durden");
// Unsuspend the user
user.Unsuspend();
Unsuspend a user asynchronously.
using Zengenti.Contensis.Management;
// Create a client
var client = ManagementClient.Create();
// Get the user
User user = client.Security.Users.Get("t.durden");
// Unsuspend the user asynchronously
await user.UnsuspendAsync();