Sunday, 19 May 2013

Using Nintex 2010 to get a users name from the User Profile Service in Sharepoint 2010

The User Profile Service is powerful, but absolutely useless if you cannot access the information it stores.
The following code and shapes will let you extract this precious information and store it in a Nintex workflow variable.

I was looking to extract the users' name based on their login. Sounds easy, but ended being a little tricky.

The next few steps assume that the User Profile Service is configured and running on your server. (Goes without saying, but I wanted to say it anyway.)

First, call the web service.


and put the data in a variable.

Now the clever bit - xml tags and the appropraite xml namespace around the data so that we can interrogate the data with XPath.

<xml xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService">
{WorkflowVariable:userProfileServiceReturnXML}
</xml>


and finally, write a clever XPath query to extract the required value.

//defaultNS:xml/defaultNS:Values/defaultNS:ValueData/defaultNS:Value

Awesome!




No comments:

Post a comment