How to Get All the Users From a Specific SharePoint Group Using NINTEX Workflow

Introduction

In this article you will see how to get all the users from a specific SharePoint group using a NINTEX workflow. We will be getting all the users from a specific SharePoint group by calling the web service "_vti_bin/usergroup.asmx". I have created a custom list named "User Collection" in which I have the following columns.

User Collection

Workflow Design

Workflow Design

Call web service action is used to get the user collection from a specified SharePoint group. Query XML action is used to query the XML and get the login name of the users. Set field value action is used to set the users to the field in the item.

Get User Collection

Use the following procedure to get a user collection from a group workflow:

  1. Navigate to the User Collection list.
  2. Click on the "List" tab and then click on "Workflow Settings".
  3. Click on "Create a Workflow in Nintex Workflow".

    Create a Workflow

  4. Click on "Cancel".

    Create a blank Workflow

  5. Drag and drop the Call web service action from the Integration section.

    Call web service

  6. You will be able to see the warning symbol in the workflow action, click on that and then you will see the following warning message:

    workflow warning message
  7. Click on "Configure" from the drop down list in the Call web service action.

    Call web service action

  8. Click on the "Insert Reference" button for the URL column and then click on the "Common" tab. Select "Web URL" and then click on "Ok".

    Web URL

  9. Append "/_vti_bin/usergroup.asmx" tp the URL column.
  10. Enter the User Name and Password to call the web service and then click on the "Reference" button.
  11. Click on "Ok".

    Web Service URL

  12. All the web service methods will be populated. Select the "GetUserCollectionFromGroup" web method that will be used to get all the SharePoint groups from the website.

    GetUserCollectionFromGroup web method

  13. Click on the "Variables" button.

    Variables button

  14. Enter the variable name and select the variable type.

    variable type

  15. Click on "Save".
  16. The variable is created successfully.

    Variable created successfully

  17. Click on the "Insert Reference" button for the groupName column and then click on the "Item Properties" tab. Select "Group Name" and then click on "Ok".
  18. Select "Specify elements", click on the "m:GetUserCollectionFromGroupResult" element and then click on the "Apply" button.

    GetUserCollectionFromGroupResult element

  19. Select the userCollectionXML variable for the "Store result in" drop down.

    userCollection XmL variable

  20. Click on "Save".
  21. Drag and drop the Query XML action from the Integration section.

    Query XML action

  22. Click on "Configure" from the drop down list in the Query XML action.
  23. Click on the "Variables" button.

    Variables button

  24. Enter the variable name and select the variable type.

    select the variable type

  25. Click on "Save".
  26. The variable is created successfully.

    Variable created

  27. Select "XML" from the XML Source drop down list.
  28. Click on the "Insert Reference" button for the XML column and then click on the "Workflow Variable" tab. Select "userCollectionXML" and then click on "Ok".
  29. Enter the XPath "/defaultNS:GetUserCollectionFromGroup/defaultNS:Users/defaultNS:User/@LoginName".
  30. Select the "users" variable from the "Store result" in the drop down list.
  31. Click on "Save".

    users variable

  32. Drag and drop the "Set field value" from the "Libraries and lists" section.

    Libraries and lists

  33. Set the value to the field.

    value to the field

  34. Click on "Save".

Publish the workflow

  1. Click on the "Publish" button in the ribbon interface.

    Publish

  2. Ensure the "Title" is set; optionally you can set the values for Description and Change Comments.

    Description and Change Comments

  3. Click on the "Submit" button.

    Submit button

  4. The workflow is published successfully.

    workflow published

Test the workflow

Use the following procedure to test the workflow:

  1. Navigate to the User Collection list.
  2. Create a new item.

    Create a new item

  3. Select the item and then click on "Workflows" in the ribbon interface.

    ribbon interface

  4. Click on the "GetUserCollectionFromGroup" workflow and then click on the "Start" button.

    GetUserCollectionFromGroup workflow

  5. After a few minutes the workflow status will be changed to "Completed".
  6. All the user's login name from the Vijai Owners group will be updated in the list item field as shown below.

    group updated

Summary

Thus in this article you saw how to get all the users from a specific SharePoint group using a NINTEX workflow.

Related Links

  1. How to Create Site Using NINTEX Workflow in SharePoint
  2. How to Delete Site Using NINTEX Workflow in SharePoint
  3. How to add user to SharePoint group using NINTEX workflow
  4. How to Remove User From SharePoint Group Using NINTEX Workflow
  5. How to Check if SharePoint Group Exists Using NINTEX Workflow
  6. How to Create User Defined Action For NINTEX Workflows in SharePoint
  7. How to Add a Group in SharePoint Site Using NINTEX Workflow
  8. How to Remove Group From SharePoint Site Using NINTEX Workflow
  9. How to Set Item Level Permission Using NINTEX Workflow in SharePoint
  10. How to Create Item in Another Site Using NINTEX Workflow in SharePoint