Skip to main content
Nintex Community Menu Bar

How to know if a user is on a Sharepoint Group?

  • January 2, 2016
  • 5 replies
  • 66 views

Forum|alt.badge.img+16

Many people posted this question and sometime ago there were some external post that dissapeared. So now it will keep safe in this post.

Create workflow variable varUserGroupXML type=Multiple Lines of Text

Create workflow variable varUserGroupNames type=Collection

Create workflow variable varIsInGroup type=Yes/No

To make it easy to reuse, create an Action Set action, and label it "Is user in group?"

Put the following within that Action Set.

Call Web Service action. Configure it as follows:

     URL: Web_URL/_vti_bin/UserGroup.asmx. Supply necessary Username/PW credentials.

  • Web Method: GetGroupCollectionFromUser
  • Editor Mode: SOAP builder
  • userLoginName(string): Initiator
  • Web Service Output: Specify elements "../m:GetGroupCollectionFromUserResult" > varUserGroupXML

Use the Run Now to verify things work. Query XML action. Configure as follows:

  • XML Source: XML
  • XML: {WorkflowVariable:varUserGroupXML}
  • Output 1: Process using: XPath.
    /defaultNS:GetGroupCollectionFromUser/defaultNS/Groups/DefaultNS:Group/@Name
  • Return Results as: text
  • store result in : varUserGroupNames

Collection Operation action. Configure as follows:

  • Target collection: varUserGroupNames
  • Exists: checked
  • Value: Value (selected from dropdown menu) - (the group name you are interested in) typed in text input
  • Store result in: varIsInGroup

Now, the value of varIsInGroup will be a yes/no.

You could probably make this cleaner by putting the group name to search for in a workflow variable as well.

5 replies

Forum|alt.badge.img+1

Just a small Typo in this Document.

The Output 1: Process using: XPath. should be

/defaultNS:GetGroupCollectionFromUser/defaultNS:Groups/defaultNS:Group/@Name


Forum|alt.badge.img+1

I followed the steps here but got the following error:

6/22/2017 10:14 AM Workflow Comment Failed to invoke web service. Error returned from server:

<soap:Fault xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>soap:Server</faultcode><faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.

What is the issue?

Thanks!

Mel


Forum|alt.badge.img+11
  • Nintex Partner
  • February 19, 2019

If you want to test the Query XML in the Workflow designer, use the full XPath string:

/soap:Envelope/soap:Body/defaultNS:GetGroupCollectionFromUserResponse/defaultNS:GetGroupCollectionFromUserResult/defaultNS:GetGroupCollectionFromUser/defaultNS:Groups/defaultNS:Group/@Name


Forum|alt.badge.img+3
  • December 12, 2019

Does anyone by chance have the Query XML instructions on how to know if a user is an owner of a Sharepoint Group (or in the Group that owns the Sharepoint Group?)


Forum|alt.badge.img
  • March 5, 2020
Our server host does not allow access to the usergroup.asmx via a Call web service action. Is there any other way to check if a user is in a SP Access Group?