共用方式為


InfoPath 2007 No Code UserName Retrieval

Just posted on using C# and the new object model in InfoPath 2007 to retrieve the current user.   I have 3 other posts that deal with this issue as well.  Believe it or not, the product team has actually addressed this in with a no code solution in InfoPath 2007.  Follow these steps to see for yourself.

  1. Create a new form by Designing a New Form Template
  2. Choose blank form
  3. Add a text box to the form (Field1)
  4. Go to Tools | Form Options
  5. Go to the Open Behavior section and click on Rules
  6. Add Action to Set a Field's Value
  7. Choose the field you added above as the field to populate
  8. For the value, click on the Fx button and choose Insert Function
  9. View All in the Categories drop down
  10. At the bottom you'll see userName, pick it
  11. The formula that gets dropped in is userName()
  12. Preview the form, you'll see your UserName in field1

That, my friends, is progress!

Tim

Comments

  • Anonymous
    June 05, 2007
    Cool! Now, can you pass parameters to the userName() function? Such as to retrieve the log-in name, or the full name, or the email... Now, THAT WOULD BE PROGRESS :)

  • Anonymous
    December 28, 2011
    Boy, you saved my life!!!my field didnt pick the current username, but picked only the user tha filled in the form....but now, it's simply fantastic.

  • Anonymous
    September 20, 2013
    That works if you use sharepoint. But I must make a form that is deployed on our network and in infopath2003