Managed Active Directory::CreateUser
The CreateUser procedure creates a new user within a specified organization according to the policy name you provide in the <policyName> element.
Arguments
Input Arguments | Required | Description |
---|---|---|
<container> |
Yes |
the Lightweight Directory Access Protocol (LDAP) path of the container in which you want to create the user. The container must correspond to the value entered the <policyName> element unless the policyName value is default. ![]()
The service provider's administration accounts should reside inside the hosting organizational unit or their default organizational unit will be the root of the domain instead of the hosting organizational unit.
|
<userPrincipalName> |
Yes |
The universal principal name of the user you want to create. |
<policyName> |
No |
The policy name appropriate for the type of user you want to create. If you do not include this element, the request uses the default value. Possible types for this name are:
|
<sAMAccountName> |
No |
The Security Accounts Manager (SAM) account name for the user. ![]()
sAMAccountName cannot be longer than 20 characters. See SAM-Account-Name Attribute for more information.
|
<givenName> |
No |
The user's first name. |
<sn> |
No |
The user's surname. |
<middleName> |
No |
The user's middle name. |
<initials> |
No |
The user's initials. |
<displayName> |
No |
The name you want to display for the user. |
<description> |
No |
The description for the user. You can include the user's title and position in the description. |
<properties> |
No |
Any valid Active Directory properties for user that you want to store with the user account, such as phone numbers and account numbers. |
<preferredDomainController> |
No |
The domain controller that you want to use for this request. Using a single preferred domain controller eliminates replication delays that arise between multiple controllers. |
Remarks
Security
- Impersonate Caller.
Sample Code
Example XML Request
<request>
<procedure>
<execute namespace="Managed Active Directory" procedure="CreateUser" impersonate="1">
<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>
Example XML Response
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>
Applies To
Managed Active Directory Namespace APIManaged Active Directory Namespace API for:
Hosted Messaging and Collaboration version 4.5
Hosted Messaging and Collaboration version 4.0
Hosted Messaging and Collaboration version 3.5
Hosted Messaging and Collaboration version 3.0
Windows-based Hosting version 4.5
Windows-based Hosting version 4.0
Windows-based Hosting version 3.5
Windows-based Hosting for Applications version 1.0