How to add permissions to a new SharePoint site using Nintex?

Requirement:

  1. I have a Site Request list in the parent site collection.
  2. I have to create a sub-sites with a particular template( such as Wiki) for every site request created in the Site Request List.
  3. Once the sub site is created, I have to set the permission to the new sub-site based on the meta data filled by the requester in the Site Request List.
  4. I have to run a Nintex workflow to create sub-sites,  which will be attached on the Site Request List.

Problem / Issue:

Out of the box with a Nintex action, setting the permissions at the site level is not possible

Solution:

Instead of expecting a Nintex action for this, you can use the method outlined in this link and the permissions web service method using a Nintex Call Web Service action:

http://msdn.microsoft.com/en-us/library/websvcpermissions.permissions.addpermissioncollection.aspx

Steps to Implement:

Use Create site action to create a new sub site under the parent site collection as shown below

Use call web service action and call the permissions.asmx web service to add permissions to the Site as shown below

Here,

Parameters

objectName
Type: System.String
A string that contains the name of the list or site.
objectType
Type: System.String
A string that specifies either List or Web.
permissionsInfoXml
Type: System.Xml.XmlNode
An XML fragment in the following format that specifies the permissions to add and that can be passed as a System.Xml.XmlNodeobject:

In the above image, varPermissionXML is an XML input variable which will have the following XML input

<Permissions>
<Users>
<User LoginName=”domain\siteadmin”
Email=”siteadmin@domain.com”
Name=”Site Admin”
Notes=”Notes”
PermissionMask=”1027801615″ />
</Users>
<Groups>
<Group GroupName=”WIKI Article Owners” PermissionMask=”-1″ />
<Group GroupName=”WIKI Article Members” PermissionMask=”1011028719″ />
<Group GroupName=”WIKI Article Visitors” PermissionMask=”138612833″ />
</Groups>
</Permissions>

If you want the exact PermissionMask number for a specific permission role refer the below xml which I have received from the GetPermissionCollection web method of the same web service.

<xml>
<GetPermissionCollection xmlns=”http://schemas.microsoft.com/sharepoint/soap/directory/”&gt;
<Permissions>
<Permission MemberID=”2″ Mask=”-1″ MemberIsUser=”True” MemberGlobal=”False” UserLogin=”Domain\siteadmin” />
<Permission MemberID=”3″ Mask=”-1″ MemberIsUser=”False” MemberGlobal=”True” GroupName=”WIKI Article Owners” />
<Permission MemberID=”4″ Mask=”138612833″ MemberIsUser=”False” MemberGlobal=”True” GroupName=”WIKI Article Visitors” />
<Permission MemberID=”5″ Mask=”1011028719″ MemberIsUser=”False” MemberGlobal=”True” GroupName=”WIKI Article Members” />
<Permission MemberID=”7″ Mask=”134287360″ MemberIsUser=”False” MemberGlobal=”True” GroupName=”Style Resource Readers” />
<Permission MemberID=”8″ Mask=”1012866047″ MemberIsUser=”False” MemberGlobal=”True” GroupName=”Designers” />
<Permission MemberID=”9″ Mask=”2129075183″ MemberIsUser=”False” MemberGlobal=”True” GroupName=”Hierarchy Managers” />
<Permission MemberID=”10″ Mask=”1011028991″ MemberIsUser=”False” MemberGlobal=”True” GroupName=”Approvers” />
<Permission MemberID=”11″ Mask=”134418465″ MemberIsUser=”False” MemberGlobal=”True” GroupName=”Restricted Readers” />
<Permission MemberID=”12″ Mask=”134287360″ MemberIsUser=”False” MemberGlobal=”True” GroupName=”Quick Deploy Users” />
<Permission MemberID=”14″ Mask=”138612801″ MemberIsUser=”False” MemberGlobal=”True” GroupName=”Viewers” />
<Permission MemberID=”1073741823″ Mask=”134287360″ MemberIsUser=”True” MemberGlobal=”False” UserLogin=”SHAREPOINT\system” />
</Permissions>
</GetPermissionCollection>
</xml>

That’s it you are done. Hope this will help you 🙂

Advertisements

About Joseph Velliah
As a SharePoint Developer my professional interests tend to be technical and SharePoint focused. I run a blog at "SP RIDER" where you can expect to read HOW TOs and scenarios that I run into during my day to day job. I hope my posts will give back a little to the community that is helped me.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: