My current project is using SharePoint 2010 and InfoPath 2010 to collect specific business related data. The initial design had three different text boxes to collect a proper name, username and email. There is nothing wrong with this approach, but this specific form had 15 individuals that we needed to collect data for. The would be a lot of data entry. Why couldn’t we just enter a user name and bring back all of this data?

Performing some quick internet searches, there are many great articles that accomplish the desired results using a Web service call to GetUserProfileByName. These articles showed step-by-step instructions on how to accomplish the desired results, but they only demonstrated how to use this technique for the current user. Even though I needed the information for the current user, I also had a business requirement to retrieve the information for other individuals in the company based on their username. Hopefully the following article will help you use the Web service approach for any person listed within your People Picker (or text box).

Steps I used:
1. Add a new data connection

2. Select “Receive data” and click Next

3. Select “SOAP Web service” and click Next

4. Enter your site collection url and add “/_vti_bin/UserProfileService.asmx?WSDL” and click Next

5. Select “GetUserProfileByName” and click Next

6. Leave parameter value blank, click Next

7. Uncheck (if checked) “Store a copy of the data in the form template” and click Next

8. Uncheck (if checked) “Automatically retrieve data when form is open,” name your data source, click Finish.

9. In the InfoPath form, add an “action” rule to an event (for demonstration purposes I am using a button).

10. Click Add, select Set a field’s value. Fill in the Field and Value text boxes.

11. In the InfoPath form, add another “action” rule to the same control. This time select “Query for data” and select the Web services created in step 8.

To retrieve values from the Web service, perform the following (PreferredName is shown as an example).

1. Determine what field you would like to populate (PreferredName). Click the fx button


2. Click “Insert Field or Group…” button


3. Switch to the Web service created earlier and select the “Value” property, and click the Filter Data button


4. Click Add button


5. Select “Select a field or group”


6. Switch to the Web service created earlier and select the “Name” property


7. Select “Type text…” and enter PreferredName


The Web service GetUserProfileByName holds many properties that might be useful:
UserProfile_GUID, AccountName, FirstName, LastName, PreferredName, WorkPhone, Office, Department, Title, Manager, AboutMe, PersonalSpace, PictureURL, UserName, QuickLinks, WebSite, Assistant, WorkEmail, CellPhone, Fax, HomePhone, PublicSiteRedirect, SPS-Dotted-line, SPS-Peers, SPS-Responsibility, SPS-Skills, SPS-PastProjects, SPS-Interests, SPS-School, SPS-SipAddress, SPS-Birthday, SPS-MySiteUpgrade, SPS-DontSuggestList, SPS-ProxyAddresses, SPS-HireDate, SPS-LastColleagueAdded, SPS-OWAUrl, SPS-ResourceAccountName, SPS-MasterAccountName

Like this post? Share it!