Tuesday, 8 November 2011

InfoPath 2010 - UserProfileService.asmx

“This blog details the steps for setting up a connection to this service.  See here for details on how to use the connection to retrieve information”

User Profile Service

The user profile service web service provides a means by which to read user profiles. 

Within applications like InfoPath it can be used to provide a codeless method for accessing information about the user filling in the form.

The User Profile Service web service can be accessed through the following URL:

http://<server>/_vti_bin/UserProfileService.asmx

The following steps can be used to add the link to the web service within InfoPath 2010

Step 1

Within the Ribbon click on the Data tab then Data Connections

InfoPath Ribbon

Step 2

A list of all the current data connection available within InfoPath will be displayed.  Click on Add

Add Connection

Step 3

The data connection wizard will now launch providing a means to create connections to submit and retrieve data.   Select Retrieve Data and click Next

Connection Wizard Data Source Type

STEP4

The next window within the wizard allows you to specify which type of data source you wish to retrieve data from.  As the User Profile Service is a web service the select SOAP Web Service and click Next

Retrieval Type

STEP 5

After selecting the data source type the next step is its location.  For the User Profile Service this is:

http://<server>/_vti_bin/UserProfileService.asmx?WSDL

Enter the location and click Next

Web Service Url

STEP 6

After providing the link to the User Profile Service web service the wizard next displays all the operations that are available within it.   To retrieve information about the current logged user select GetUserProfileByName the click Next

Web Service Method

STEP 7

As we want information about the current user the next screen within the wizard can be left with the default value.  Click Next

Default Value

STEP 8

The next screen within the wizard can be left with the default values. Click Next

Wizard Default

STEP 9

Within the final screen of the wizard provide a name for the new data connection.

Check the box to Automatically retrieve data when form is opened

Then click Finish

Connnection Name

A data connection for retrieving information from the User Profile Service should now have been created. 

1 comment: