I have a NW2010 workflow, and I'd like to base a conditional in the workflow on if the user is a member of a particular SharePoint group. How would I go about accomplishing this?
You can put the members of a group in a collection variable and check to see if the user is in that variable.
I found the solution a few minutes ago: http://blog.cube4.com.au/?p=953
Sorry to bother, but the link to the solution is broken and I am in the same situation.
Can you please post the solution? Or point me out to the right direction?
Thank you!
I see that URL is indeed down. So the fix goes like this.
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.
Use the Run Now to verify things work.
Query XML action. Configure as follows:
Collection Operation action. Configure as follows:
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.
So that's how my actual workflow looks. I wished the URL http://blog.cube4.com.au/?p=953 with the actual documentation worked. May this be sufficient to get you steered in the right direction.
Thank you very much Alan,
Yes that was very helpful. I've almost completed it.
My only problem now is that the XML returned by the web services doesn't seem to fit in the variable varUserGroupXML, even though it is a multiple lines of text variable. I've been debbuging it using the "log in the history list" box and it seems it only stores a part of it:
<GetGroupCollectionFromUser xmlns="http://schemas.microsoft.com/sharepoint/soap/directory/"><Groups><Group ID="7" Name="ProcesosUsers" Description="Use este grupo para conceder a los usuarios permisos de colaboración en el sitio de SharePoin
I would try to fix it. But any ideas will be welcome
Just one thing, the call to the web service you gave me needs one "_" before "vti_bin...", jut in case anyone needs to use it:
URL: Web_URL/_vti_bin/UserGroup.asmx
Thank you again
I fixed it!
I had an error in the Query XML box, there was no error with the varUserGroupXML.
If you can, change the answer to your longer explanation. And thank you for posting it. To really make this reusable, I would take the action set and drop it into a UDA.
Thanks for pointing that out. i updated it to show _vti_bin. And I'm glad the solution worked for you. I'd love to take credit for it, all I did was copy and paste what somebody else developed.
Hi Alan
First of all thanks for your post. It helped me alot.
Just a minor correction is that your XPath Output 1 section have a capital D in DefaultNS:
/defaultNS:GetGroupCollectionFromUser/defaultNS/Groups/DefaultNS:Group/@Name
but should be:
/defaultNS:GetGroupCollectionFromUser/defaultNS/Groups/defaultNS:Group/@Name
I point it out just in case somebody would get the same errors as I did 😕
Once again thank you for the post tho. As I said it is just a minor hehe
Kind regards
Michael