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).
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