Skip to main content

Suspend or Unsuspend a user account

Log in to add to favourites

Suspending 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

C#
public void Suspend()
{
}
C#
public async Task SuspendAsync()
{
}
C#
public void Unsuspend()
{
}
C#
public async Task UnsuspendAsync()
{
}

Examples

Suspend a user synchronously.

C#
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

C#
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.

C#
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.

C#
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();

Still need help?

If you still need help after reading this article, don't hesitate to reach out to the Contensis community on Slack or raise a support ticket to get help from our team.
New support request