InfoPath – Some Need-To-Know Information

Originally posted on: http://geekswithblogs.net/SoYouKnow/archive/2009/03/13/infopath-ndash-some-need-to-know-information.aspx

We are using InfoPath with SharePoint more and more in our organization. Anyone who has dealt with InfoPath knows there’s a lot of nice functionality there, but it can also be a pain to work with.  I ran across a couple of issues I was finally able to resolve and wanted to spare you guys the same pain I went through.

 

1. Installing a Code Signing Certificate on an InfoPath form

If you want to really take advantage of what InfoPath can do (get user information, pre-populate fields with external data, etc.) you may find it necessary to use a Code Signing Certificate.  Here is what I had to go through:

Acquiring and Installing Code Signing Certificate

Here is a blog that details how to acquire and install a code signing certificate.  This is an old blog from 2005 and you only have to go through step 3. I purchased a Thawte certificate by the way. 

Setting Up InfoPath Form to Use Certificate

After the certificate is installed you will need to set the trust level on your InfoPath form and associate the Certificate with your InfoPath form. To do this:

  • From the design view of your InfoPath Form go to Tools->Form Options
  • Click on “Security and Trust”
  • Select your Security Level
  • Under the “Form Template Signature” click on “Select Certificate”
  • Click on the Certificate you just installed and click “OK”

There you go, that’s pretty much all there is to it.  What?  You mean your certificate was not in the list of certificates to choose from when you clicked “Select Certificate”?  I had the same thing happen to me.  I went through the steps of installing the certificate a second time and then I was able to successfully use the certificate.  I know of at least 2 other people who had the same experience, must be an unknown feature??

2. Determining FBA Username in InfoPath

If you are using FBA with your InfoPath form you have probably found out that the UserName function for InfoPath does not work.  You probably also realized  after Googling for a solution that there isn’t much information out there to help (unless I just used the wrong magical combination of keywords which is very possible).   So, how do you determine the FBA username in InfoPath?  It actually turned out to be fairly trivial using only one line of code:

  • From the design view of your InfoPath Form go to Tools->Programming->Loading Event
  • In whatever part of your code you need to access the username insert this line of code:
    • String name = (this.Application.User.LoginName);

    The returned LoginName is pre-pended with some information followed by a colon and the username.  Is this information accessible without writing code? That, I don’t know.  If someone does, please leave a comment.

     

    Well, there you have it.  Nothing glamorous or earth shattering, but hopefully it made your life a little bit easier.  As always, your feedback is appreciated.

    Families in Germany who are facing divers health problem, such persons can buy drugs from the Web without prescription. With the market flooded with divers web-sites selling sundry medicaments, purchasing medicines from th WEB is no longer a trouble for common man. Certain medications are used to treat infections caused by dental abscesses. Of course it isn’t all. If you’re concerned about erectile soundness problem, you probably know about Xenical and Hoodia. Probably every adult knows about Garcinia. (Read more PhentermineXenical). The symptoms of sexual soundness problems in men include impossibility to have an hard-on sufficient for sexual functioning. Certain medications may add to sex drive difficulties, so its vital to cooperate with your health care professional so that the prescription can be tailored to your needs. Preparatory to taking Levitra or other medicament, speak to your dispenser if you have any allergies. Talk to your health care provider for more details. Preparatory to ordering this remedy, tell your physician if you are allergic to anything.