Click or drag to resize

AdministrationClientCreateSecurityAccountForNewUser Method

Syntax
C#
public Result CreateSecurityAccountForNewUser(
	ManagementGroupRequestOfCreateSecurityAccountForNewUser request
)

Parameters

request
Type: AdministrationServiceManagementGroupRequestOfCreateSecurityAccountForNewUser

Return Value

Type: Result
Examples
C#
using (var svc = new AdministrationService.AdministrationClient())
{
  var request = new AdministrationService.ManagementGroupRequestOfCreateSecurityAccountForNewUser();
  request.Token = "Token";//Required - Token returned from AccountService.ManagementGroupLogin
  request.ManagementGroup = "Management group";//Required - ManagementGroup supplied when calling AccountService.ManagementGroupLogin

  var createSecurityAccountForNewUser = new AdministrationService.CreateSecurityAccountForNewUser();
  createSecurityAccountForNewUser.AccountName = "Account name"; //Required - Must be unique
  createSecurityAccountForNewUser.EmailAddress = "john.doe@simplicitycrm.com"; //Required - The email address to recieve activation requests and password reset requests
  createSecurityAccountForNewUser.Title = "Mr"; // Valid values are : 'Dr', 'Sir', 'Lady', 'Mr', 'Miss', 'Ms' or 'Mrs' (case sensitive)";
  createSecurityAccountForNewUser.FamilyName = "Doe"; //Required
  createSecurityAccountForNewUser.GivenName = "John"; //Required
  createSecurityAccountForNewUser.ResetPasswordEmailTemplateID = "RESET_PASSWORD_REQUEST"; //Optional - if supplied, sends email to specified email address 

  var managementGroup = new AdministrationService.SecurityAccountManagementGroup();
  managementGroup.GroupCode = "LOYALTY_MEMBER";//Required        
  managementGroup.CanApproveTransactions = false;//Optional
  //all other managementGroup properties ignored
  createSecurityAccountForNewUser.ManagementGroups = new AdministrationService.SecurityAccountManagementGroup[] { managementGroup }; //Required - The management groups for the new account        

  // add createSecurityAccountForNewUser to request
  request.Value = createSecurityAccountForNewUser;//Required        

  AdministrationService.Result result = svc.CreateSecurityAccountForNewUser(request);

  if (result.FaultCode == 0)
  {
    //Request succeeded
  }
  else
  {
    //Request failed        
    throw new Exception(result.FaultDescription);
  }
}
See Also