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: 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.