Share via


ManagedSharePoint2007::AddUsersToRole

The AddUsersToRole procedure adds one or more Active Directory (AD) Accounts as users to the role.

Arguments

Input Arguments Required Description

<preferredDomainController>

Yes

Required input. The preferred domain controller.

<org>

Yes

Required input. The Lightweight Directory Access Protocol (LDAP) path of the organization that owns the site.

<siteName>

Yes

Required input. The site name which is unique within organization and is stored in the pointer.

<site>

Yes

Required input. The SharePoint site containing the cross-site group that the user is to be added.

<roleName>

Yes

Required input. A string that contains the name of the site group to add the user to.

<users>/<user>

Yes

Required input. Data for each user containing:

  • <userPrincipal>: Required input. Used to get the user name (DOMAIN\User_Alias) of the user.

  • <name>: Optional input. The name of the user to add.

  • <email>: Optional input. A string that contains the e-mail address of the user.

  • <notes>: Optional input. A string that contains notes for the user.

Remarks

Procedure Step

  • Call the Sharepoint Provider::AddUsersToRole method to add specified users to role

Security

The AddUsersToRole procedure has the following security requirements:

  • Impersonate Caller

  • Caller tested for OrgCreator permissions

Sample Code

Example XML Request

<request> 
        <procedure> 
                <execute namespace="ManagedSharePoint2007" procedure="AddUsersToRole" impersonate="1"> 
                        <executeData> 
                                <org>LDAP://ou=alpineskihouse,ou=consolidatedmessenger,ou=hosting,dc=fabrikam,dc=com</org> 
                                <preferredDomainController>ad01-wh.fabrikam.com</preferredDomainController> 
                                <target>https://www.example6.com</target> 
                                <roleName>Reader</roleName> 
                                <users> 
                                        <user> 
                                                <userPrincipalName>WSS12@alpineskihouse.com</userPrincipalName> 
                                                <name>WSS12</name> 
                                                <email>WSS12@alpineskihouse.com</email> 
                                                <notes>foo</notes> 
                                        </user> 
                                </users> 
                                <SiteName>example6</SiteName> 
                        </executeData> 
                </execute> 
        </procedure> 
</request>

Applies To

Managed SharePoint 2007 Namespace for:

  • Hosted Messaging and Collaboration version 4.5

  • Hosted Messaging and Collaboration version 4.0

  • Windows-based Hosting version 4.5

See also

Tasks

ManagedSharePoint2007::RemoveUsersFromRole
ManagedSharePoint2007::AddGroupToRole