Skip to main content
Browse Documentation

Suspend or Unsuspend a user account

Created by Chris Neale, last updated 06 Dec 2020

Suspending or Unsuspending a user's account can be achieved by calling one of the follwoing 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();