You are here

You are here

Delete User

This example shows how to find a user and delete them from Address Book.

This example shows how to fully delete a user.  If you would rather disable their login without deleting them, use the Create User sample and just update the user's EnabledUTCEndDate to a date in the past

Vertical Tabs

c#
SCMContactInfo[] users = springCMService.ContactFind(token, "jdoe@springcm.com", false);
 
if(users.Count()==1)
{
    Console.WriteLine("User First Name: {0}", users[0].FirstName);
    Console.WriteLine("User Last Name: {0}", users[0].LastName);
    Console.WriteLine("Deleting user...{0}",users[0].Id);
 
    springCMService.Delete(token, SCMObjectType.User, users[0].Id);
}
java
SCMContactInfo[] users = springCMService.contactFind(token, "jdoe@springcm.com", false);
 
if (users.length == 1)
{
     System.out.println("User First Name: " + users[0].getFirstName());
     System.out.println("User Last Name: " + users[0].getLastName());
     System.out.println("Deleting user...." + users[0].getId());
 
     springCMService.delete(token, SCMObjectType.User, users[0].getId());
}
php
$userToDelete = '<email address of the user to delete>';
 
$userObject = $springCM->ContactFind( array(
	'token'=>$token,
	'SearchText'=>$userToDelete,
	'IncludeDeleted'=>false
));
 
$userObject = $userObject->ContactFindResult;
 
if (sizeof($userObject->SCMContactInfo) > 0);
{
	$springCM->Delete( array(
		'token'=>$token,
		'type'=>'User', // could also be 'Contact'
		'id'=>$userObject->SCMContactInfo->Id
	));
}