“This blog details the steps for using the user profile service. Click here for details on how to create a connection to retrieve information”
The following steps outline how to pull through the logged in users “preferred name” from the User Profile Service web service.
STEP 1
Right click a field within the fields data source and chose properties
STEP 2
Within the text box properties window click the formulas button
STEP 3
Within the insert formulas window click Insert Field or Group
STEP 4
Within the Select a field or group window choose the GetUserProfileByName data source. Expand the data fields and select Value then click Filter Data
STEP 5
Within Filter data click Add
STEP 6
With specify filter connection window click Select Field or group
STEP 7
Within Select a field or group window select Name and click OK
STEP 8
Within the specify filter conditions window enter a text filter: e.g “PreferredName”
Then click OK
STEP 9
The filter window should now show the following:
Name = “PreferredName”
Within the filter data window click OK
STEP 10
Within the Select a field or group window click OK
STEP 11
The insert formula window should now show:
Value[Name="PreferredName"]
Click OK
STEP 12
The text box properties window should now show formula. Then click OK
As well as the preferred name other information you can get from the user profile service are include in the table bellow:
AccountName |
FirstName |
LastName |
WorkPhone |
Manager |
UserName |
WorkEmail |
Another great post. Thanks! Got it working off these instructions straight away!
ReplyDeletehow do i also retreive the information based on the employee selected in a people picker
ReplyDeleteWhen I do this, I end up with DOMAIN\Username. If I don't set the default values, I can type in my full name, and click check, and it displays the full name, but if I autopopulate it, it's only showing domain\username, even when I specify "PreferredName". Is this just how the accounts are set up in my Sharepoint Server?
ReplyDeleteGlad to know this works in 2010. Should someone by kind enough to answer... My 2007 form works fine in the preview, yet when I try to duplicate this in a new infopath 2010, form, it fails in preview but works if you open the published form in sharepoint. Here is the error:
ReplyDeleteThe SOAP response indicates that an error occurred on the server:
Server was unable to process request. ---> Attempted to perform an unauthorized operation.
Any thoughts ?
When I do the above I am able to get the Preferred Name SOMETIMES. It works then it does not work then a few hours later it works again with no changes. I have increased my Data Connection Timeout and also make sure the app pool service and the userProfileService in Central Admin have the same permissions. Do you have any idea why? I have been searching for days for an answer.
ReplyDeleteNote: when I create the data connection in infopath it asks for my credentials, I type them in however they do not take, (asks again) I hit cancel and it lets me continue and it creates the Data Connect
Using: Infopath 2010, SharePoint Enterprise 2010
Any help would be a great help.