Windows-based Hosting::AddUserToSharePointSiteRole

The AddUserToSharePointSiteRole procedure adds a user to a Windows SharePoint site role.

Note

In order to successfully use MPS to add users to a SharePoint site using the Windows-based Hosting web service, you must be logged into the domain as a domain administrator.

Arguments

The AddUserToSharePointSiteRole procedure requires the following input parameters.

Input Argument Description

<org>

The Lightweight Directory Access Protocol (LDAP) path of the organization that will own the Web site.

<siteName>

The site name which is unique within the organization and stored in the pointer. You can also use the <target> node described below.

<target>

The SharePoint site containing the cross-site group to which the user is to be added.

<roleName>

A string that contains the name of the site group to which the user is added.

<users>/<user>

The data for each user, which contains:

  • <userPrincipal> - Gets the user name (DOMAIN\User_Alias) of the user.

  • <name> - An optional string that contains the display name of the user.

  • <email> - An optional string that contains the e-mail address of the user.

  • <notes> - An optional string that contains notes for the user.

<preferredDomainController>

The name of the preferred domain controller.

Output Arguments

The AddUserToSharePointSiteRole procedure has no return values.

Remarks

Security

The AddUserToSharePointSiteRole procedure has the following security requirements:

  • The caller is impersonated.

  • The caller is tested for OrgCreator permissions.

Process Steps

The following step occurs when adding a user to a Windows SharePoint site role with the AddUserToSharePointSiteRole procedure of the Managed Windows-based Hosting Namespace:

  • Add the user to the site role by calling Managed Windows SharePoint Namespace::AddUsersToRole.

Sample Code

Example XML Request

The following is an example of an XML request for the AddUserToSharePointSiteRole procedure of the Managed Windows-based Hosting Namespace:

<request> 
        <procedure> 
                <execute namespace="Windows-based Hosting"  
                procedure="AddUsersToSharepointSiteRole" 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 Windows-based Hosting Namespace API for:

  • 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

See also

Tasks

Windows-based Hosting::RemoveUserFromSharePointSiteRole