I have SharePoint 2010 and InfoPath 2007. I am using the webservices to get the user name into the forms text box. I have followed this post and its works fine:

InfoPath - Get the current user without writing code

I followed the post to the letter and it works. I logged in as Admin and deployed the form and I get the Admin as the user name. But now when I log in using different user credentials the username doesn't update and I still get the same Admin user name

Do I need to do some additional things other than the blog post? Please suggest

  • Check step '7. Click next and make sure Automatically retrieve data when form is opened is checked.' Sep 8, 2011 at 7:16
  • Yeah I already did that and I as I mentioned I followed the steps exactly. Please suggest. Sep 8, 2011 at 7:18
  • Just to check: Are you using browser-enabled forms or are you opening forms in InfoPath? Sep 8, 2011 at 7:48
  • Forms opening in Infopath Sep 8, 2011 at 7:57
  • And this is issue then! Look at end of my answer. I didn't see your last comment before posting. Sep 8, 2011 at 7:59

1 Answer 1


I followed post step by step and it works fine. When I log with different user I receive different data. So there are two options how to solve your problem this:

Start from scratch

or just to verify everithing is ok insert a button and add two rules to it:

  1. Set field value of GetUserProfileByName > QueryFields > tns:GetUserProfileByName > AccountName to function userName()
  2. Query For Data > GetUserProfileByName

Try to click button and see if your data is still same. If answer is yes - problem is outside of your Infopath form.

This was all tested on InfoPath 2010 with browser enabled forms deployed on SP Form library.

Addition: It is obvious that if you open form in InfoPath client application (and not in browser enabled form) current InfoPath user will be current Windows user not user logged in SharePoint.

  • Hello, I used the browser enabled forms and installed the State Service Application. Then I published the form and it works fine. Thank you for your suggestion Sep 8, 2011 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.