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

Requirement:

  • I have a Site Request list in the parent site collection.
  • I have to create a sub-sites with a particular template( such as Wiki) for every site request created in the Site Request List.
  • 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.
  • I have to run a Nintex workflow to create sub-sites,  which will be attached on the Site Request List.

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:

https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-server/bb249917(v=office.15)?redirectedfrom=MSDN

Steps to Implement:

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

Create Site

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

set Permission

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/">
<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.