Cloud and Microsoft technologies enthusiast architect in Switzerland RSS 2.0
# Tuesday, October 16, 2012

That is something we do almost every time when building workflows. Indeed, at some point in your process, you need to know who belongs to a SharePoint group and you wonder how to get this user’s list. Of course, there is a SharePoint API for that, but when working with Nintex, the only way, if you don’t want to code your custom action, is to use the SharePoint web services. And because it is something that is regularly needed, it made sense to have a “User Defined Action”, just for that. Not that it is difficult to do, but it is quite useful to have a single action that would return the list of user for a given group.

The SharePoint web service that can be used is located at /_vti_bin/usergroup.asmx . One of the method that can be called and which is especially interesting is GetUserCollectionFromGroup that has the following WSDL signature.

POST /_vti_bin/usergroup.asmx HTTP/1.1
Host: myserver
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: ""

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="" xmlns:xsd="" xmlns:soap="">
    <GetUserCollectionFromGroup xmlns="">

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="" xmlns:xsd="" xmlns:soap="">
    <GetUserCollectionFromGroupResponse xmlns="">

As it can be seen, the web method only needs a “groupName” string parameter and returns a user collection (in other words, an array of users, which is in fact a <Users><User></User></Users> element).

So, to create a useful UDA, the parameters that it should have are :

Parameter Type Direction
The Web Service URL Text Input
The Group Name Text Input
The XML Field you are interested in Text Input
The Collection of Users Collection Output



The special thing here is the “XML Field your are interested in”. Because I didn’t want to limit the UDA to return either the login or the user first or last name, I decided to leave the decision to the user calling the UDA to choose which field to get in the collection. The format of the parameter is directly tied to the XML outputted by the web service :

<GetUserCollectionFromGroup xmlns="">
        <User ID="116"
                    Flags="0" />

If you are interested in the name, the parameter should contain "@Name”, as it is an attribute of the User element. On the other side, if you are interested in the e-mail of the users, then it should contain “@Email”. The image below shows the activities being part of the UDA. Basically, 3 activities are needed : Call Web Service, Query XML, Regular Expression.


To configure the Call Web Service activity, enter the URL of the usergroup site’s web service, for example http://myserver/_vti_bin/usergroup.asmx. Enter the user name and password of an account that has the permissions to call the web service in the appropriate text box. A good practice would be to define a protected constant and to select it using the lock icon. Clicking on the Refresh button will list all the methods available from this web service, so, select the “GetuserCollectionFromGroup” one:


Once this is done, the parameters will be listed in the “Web service message” section. You can then replace the different web method arguments by the UDA’s parameters, such as “URL”, “groupName” and “Store result in”. You will end with the following configuration :


The next activity, “Query XML” is there to parse the XML response we get from the web method, and to create the collection of users. In the case below, we use the semi-colon as a separator, and we use the “User Field” UDA’s parameter to match the correct attribute using an XSL, the bold part corresponding to the UDA’s parameter :

<xsl:stylesheet version="1.0" xmlns:xsl="" xmlns:p="">
    <xsl:template match="p:GetUserCollectionFromGroup/p:Users">
        <xsl:for-each select="p:User">
        <xsl:value-of select="{WorkflowVariable:User Field}"/>;</xsl:for-each>

Finally, the “Query XML” should look like :


The very last activity is “Regular Expression”. For a reason that I still have to understand, the collection generated by the “Query XML” activity and stored in the “ParsedGroupUsers” does not behave like a “correct” collection. This is why I use such “Regular Expression”, to split the “ParsedGroupUsers” variable using the semi-colon, and to store the result in the “User Collection” output parameter :


That’s it !

Publish the User Defined Action and then use this UDA in your workflows.

Tuesday, October 16, 2012 2:06:00 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] -
Nintex | SharePoint
All comments require the approval of the site owner before being displayed.
Please login with either your OpenID above, or your details below.
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Live Comment Preview
Google Cloud Platform Certified Professional Cloud Architect
Ranked #1 as
French-speaking SharePoint
Community Influencer 2013
Currently Reading :
I was there :
I was there :
I was exhibiting at :
I was there :
I was a speaker at :
I was a speaker at :
I was a speaker at
(January 2013 session):
I was a speaker at :
I was a speaker at :
United Nations (UN) SharePoint Event 2011
I was a speaker at :
I was there !
I was there !
I was there !
I was there !
<December 2022>
About the author/Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2022
Yves Peneveyre
Sign In
Total Posts: 290
This Year: 0
This Month: 0
This Week: 0
Comments: 20
Pick a theme:
All Content © 2022, Yves Peneveyre
DasBlog theme 'Business' created by Christoph De Baene (delarou)