Creating a user account by using XML

Use the CreateUser procedure of the Managed Active Directory namespace to create an account for a user. The CreateUser procedure creates a new user within a specified organization according to the policy name you provide in the <policyName> element.

This procedure expects to be called with impersonate="1". The procedure impersonates the caller.

Example of a request that calls the CreateUser procedure

<request>
  <procedure>
	<execute namespace="Managed Active Directory" procedure="CreateUser">
	<executeData>
		<container>LDAP://OU=Reseller1,OU=Hosting,DC=contoso,DC=com</container>
		<userPrincipalName>upnMyUser1</userPrincipalName>
		<sAMAccountName>Accntname</sAMAccountName>
		<policyName>reseller</policyName>
		<displayName>Joe Smith</displayName>
		<givenName>Joe</givenName>
		<middleName>John</middleName>
		<sn>Smith</sn>
		<initials>JS</initials>
		<description>User description</description>
		<properties>
		<property name="otherHomePhone">
			<value>425-555-1212</value>
			<value>206-555-1212</value>
		</property>
		</properties>
		<preferredDomainController>myPrimaryDC.contoso.com
			</preferredDomainController>
	</executeData>
	<after source="executeData" destination="data" sourcePath="user" />
	</execute>
  </procedure>
</request>

Input for CreateUser

The following input is valid for this request:

Typical response for CreateUser

This procedure returns the <user> tag containing the user object created and the membership and security policies supplied. Each object created has its LDAP path in a path attribute.

<response>
  <data>
	<user path="LDAP://cn=upnMyUser1,OU=Reseller1,OU=Hosting,DC=contoso,DC=com" 
		name="upnMyUser1" samName="upnMyUser1"></user>
  </data>
</response>

Important