InfoPath Gotcha: User Profile Displaying Admin User

One of the most commonly used SharePoint web services through InfoPath is the UserProfileService. This service can render information about the current user accessing the form. (click here if you need to find out more about how to use UserProfileService)

I was developing an InfoPath solution that required the logged-in-user’s Manager and Department information. Naturally, the UserProfileService is a great candidate to achieve this requirement. As a first step, I created the data connection and configured the form to display user’s first name. I verified by previewing the form in InfoPath Designer and saw that my first name was displayed properly. Everything was looking kosher, so I proceeded to publish the form onto SharePoint as a web-based-form. I then opened the form in SharePoint, and instead of seeing my user info, I saw the user info for a SharePoint admin.

InfoPath shows wrong user info

Confused Bobby

This dazed and confused look went on for a couple of weeks as I searched and searched the Interweb for answers. As luck would have it, I had the chance to sit in on Clayton Cobb‘s InfoPath session during SharePoint Saturday The Conference. I approached Clayton with this problem and he instantly knew the remedy.

Apparently in a claims-based-authentication farm, SharePoint Form Services mistakenly displays the service account that manages the application pool’s worker process. This means two things: (1) I’m not completely crazy (2) I need to find a workaround from Clayton. Thankfully there is one.

Here’s the workaround, if your UserProfileService is displaying an admin user account:

  • Disable auto-retrieval of the UserProfileService Data Connection
    1. Modify the Data Connection
    2. Get to the last step of the wizard and deselect “Automatically retrieve data when form is opened”
      Disable auto retrieval
  • Create a new Form Load rule
    Form Load ribbon
  • In the Form Load rule window, select “Set a field’s value” in Actions
  • Set the “Account Name” query field to the current username
    1. Assign your Field by selecting the User Profile data connection > queryFields > AccountName
      Query Account Name
    2. Assign the value with the following:
      1. Click fx button button
      2. Insert function of concat
      3. Replace the inside of the concat function with
      4. Then insert function of username
      5. Your formula should like the following below
        Value Formula
      6. Click OK twice to save your form load rule
        Form Load Rule
  • Publish your form to SharePoint

Now you should be able to see the correct user profile information.

User Profile shows correctly

Moral of this experience. Don’t bother troubleshooting it yourself, just talk to an MVP.



  1. Thank u for this Blog,
    I have tried it but i have an error as:
    A query to retrieve form data cannot be completed because this action would violate cross-domain restrictions.

    If this form template is published to a SharePoint document library, cross-domain access for user form templates must be enabled under InfoPath Forms Services in SharePoint Central Administration, and the data connection settings must be stored in a UDC file in a data connection library in the same site collection.

    If this is an administrator-approved form template, the security level of the form must be set to full trust, or the data connection settings must be stored in a UDC file by using the Manage data connection files option under InfoPath Forms Services in SharePoint Central Administration.

    An entry has been added to the Windows event log of the server.
    Log ID:6932

    Correlation ID:7555870b-28b3-4784-a665-ae507bb2622e

    Can u help me please

    • Hey Dima,

      is your data connection pointing to the same site where the form library is? eg: if your fom library is located in then your data connection must be…

      twitter: @bobbyschang

  2. Hi Bobby,

    I’m still facing this issue, Data connection is pointing to the same site where the form library is.

    thanks in advance

    • Hey Zebu,

      Please make sure that you have disabled/deselect “Automatically retrieve data when form is opened” in your Data Connection.

      I also recommend passing the username() function to a Calculated Field on your form. That way you can verify what value your form produces for the username() function.

      twitter: @bobbyschang

    • Is anything coming across at all? If no data appears on your form, you may need to see if you could access the web service. Put the user profile service URL in your browser and see if you could access it.

  3. Hi Bobby,

    As the same way can you please elaborate how to get First Name(FirstName), Last Name(LastName), Full Name (PreferredName), (Email Address (WorkEmail) and so on.

    Because I have tried the following

    Value[Name = “FirstName”], Value[Name = “LastName”], Value[Name = “WorkEmail”]. But they give me FirstName as SPPrdAdmin, LastName as empty and PreferredName as SPPrdAdmin and WorkEmail as empty.

    I am using the .UDCX file for the data connection to the WebService and Userprofileservice.asmx.

    I cannot understand what I have done wrong.

    Please help.

    • Hi Chiranthaka, this web service reads from the User Profile. First thing to check is if that user profile has all the fields, that you want to surface, populated. The fact that First and PreferredName are coming back with data, could indicate that you have missing data on that profile. I would also try using a different user, to see if you get different results. Hope this helps

  4. I was able to get the user’s display name in InfoPath 2007 with MOSS and Kerberos simply by using the InfoPath function username(). Now I’m developing in SharePoint 2013 using claims and I am very glad I found your blog. Do you know if this work-around is due to authentication or the software version?

  5. Hi Bobby,

    Do we need to set the textbox control value to preferred name? and then write the rule in form load?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s