Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

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

1 Answer

up vote 0 down vote accepted

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.

share|improve this answer
    
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 –  Chandra Shekhar Sep 8 '11 at 9:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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