Create Security Groups In SharePoint 2016 Using Web Service And Nintex Workflow 2016

SharePoint 2016 general availability was announced in the Future Of SharePoint conference in May 2016. The series that discusses the installation of SharePoint 2016 in Azure can be found at C# Corner from the below links,

Nintex is a premium technology partner for SharePoint. With the announcement of SharePoint 2016, Nintex has made the announcement of the general availability of Nintex Workflow 2016, on July 11, 2016.

In this article, we will see how to create a SharePoint Group using Nintex Workflow, based on the list item created in a configuration list. The scope of the article is:

  • Create a configuration list that will hold the SharePoint Group creation information.
  • Create an item in the list which will include SharePoint Group Name.
  • Trigger a Nintex Workflow on item creation and create a SharePoint Group based on the configuration List Item column values.

    sites

Create the following columns in the SharePoint List.

columns

Now, the basic infrastructure is in place. Let’s go ahead and design the workflow. Click on ‘Create a Workflow in Nintex Workflow’ from the Workflow Settings option.

Workflow Settings

This will open the Nintex Workflow designer. Right click the workflow and add the ‘Call Web Service’ activity.

Call Web Service

The action will show the following warning as some of the configuration values are missing.

warnings

From the drop down, click on ‘Configure’.

Configure

The configuration page contains the details that will be used for SharePoint group creation. In the URL field, add the URL for the usergroup.asmx. We will fetch the web URL dynamically and append “_vti_bin/usergroup.asmx” to it, so that a full web service URL is created. From Insert Reference tab, add Web URL.

Web URL

Add the site collection administrator credentials which will be used by the workflow to connect to the web service. Click on Refresh. This will populate the web methods in the drop down.

credentials

Select the web method that will be used to create the SharePoint Group, i.e.,‘AddGroup’.

group

We have to add a set of Web Service input parameters, as shown below. ‘groupName’ will be dynamically assigned the value of the List Column ‘SP Group Name’.

groupName

‘ownerIdentifier’ will be dynamically assigned the value of the Configuration List Column ‘ownerIdentifier’.

ownerIdentifier

‘ownerType’ will be dynamically assigned the value of the Configuration List Column ‘ownerType’.

ownerType

‘defaultUserLoginName’ will be dynamically assigned the value of the Configuration List Column ‘DefaultUserLoginName’.

defaultUserLoginName

‘description’ will be dynamically assigned the value of the Configuration List Column ‘Group Description’.

description

Thus, the form after all the configurations will look as shown below.

configurations

Ensure that you select the check box ‘Encode inserted tokens’, else you might stumble upon web service invocation error as shown below.

Encode inserted tokens

If you want to see the SOAP message that is sent to the web service, select the radio button ‘SOAP Editor’.

SOAP Editor

The workflow activity will finally look like:

workflow activity

Now, let’s mention when the workflow should run. Select Workflow Settings.

Workflow Settings

Specify the workflow name and description, and set the start conditions ‘Start when items are created’ to Yes.

workflow

Go ahead and publish the workflow.

workflow

Make any final changes to the workflow name and description.

description

The publishing of the workflow has started.

publishing

Finally, the workflow is published.

published

Let’s create a list item with the name of the SharePoint Group that has to be created.Specify the SP Group Name,Group Description,Owner Type,Default User Login Name, and Owner Identifier, which will be used by the web service to create the group.

create

A new column by the name of the workflow has come up in the list and it shows the status of the workflow. The status has become ‘Completed’ which shows the successful creation of the group.

new

Heading over to the People and Groups page, we can see the newly created site there.

People and Groups

Summary

Thus, we learned how to create a Group in SharePoint 2016, based on the list item created in a list, using web service and Nintex Workflow 2016.