I am getting the following error when trying to create a new InfoPath form from a forms library:

The custom code in the form cannot be run. This functionality may be deactivated on the server. For more information, contact the server farm administrator.

The form codebehind doesn't do anything fancy - it just handles a couple of _Changed events by doing some date/time calculations and setting a couple of values on the form. Nevertheless, I inserted a [assembly:AllowPartiallyTrustedCallers] statement above the namespace declaration.

I used some techniques from Get user information without writing code to retrieve the username, title, department, and manager name of the person filling out the form (this is accomplished within the form, not in the codebehind). I also connected to a SharePoint list to retrieve some information which is then populated to the form.

I deployed the form as an administrator-approved form template. Then, I uploaded and activated it in Central Administration > Manage Form Templates.

Sandboxed solutions are enabled on the server. Form works fine when run locally.

What is causing the error?

Edit: I created another form and had no errors, until I added an empty codebehind for that form. Then I got the same error as above, even though there is no actual code in the codebehind. Am I missing a simple server setting somewhere?

  • I have encountered similar issue. I uploaded administrator approved- full trust form(without digital signature). It's erroring out wih some correlation id(I can't find the error id in any of the ULS logs). When I tried to open the form template. It's asking for digital signature. Any one please help me out. Thanks
    – user14457
    Jan 28, 2013 at 10:11
  • @srikanth You need to add the digital signature.
    – LFurness
    Feb 1, 2013 at 13:39

3 Answers 3


After spending much of today on the phone with Microsoft developer support, it turns out that this is a legitimate bug. It was fixed by the August 2011 cumulative update for SharePoint Server. Once I installed that successfully, the above error no longer occurred.


Make sure the form is set to Full Trust under the Security and Trust section of Form options.

InfoPath allows you to add a form as administrator approved without making sure it is set to Full trust, however code solutions require it to be set.

  • I already have the form security level in InfoPath Designer set to Full Trust, so unfortunately that does not seem to be the answer.
    – LFurness
    May 14, 2012 at 16:42
  • Is this server also a DC by chance? There are some additional restrictions when that is the case... not much else i can think of that could cause this unfortunately... and i suppose for the record, Microsoft SharePoint Foundation Sandboxed Code Service (Central admin) and the SharePoint 2010 User Code Host are both started?
    – Zork
    May 14, 2012 at 18:59
  • Server is not a DC. Both of those services are started. Thanks for posting though.
    – LFurness
    May 14, 2012 at 19:34

I was working with Browser-enabled forms about a year ago and was having similar problems to what you have described. Zork is right in that it needs to be Full Trust, but you also need to digitally sign the form for coded web forms. This is found in the Advanced Form Options > Security and Trust, under the heading Form Template Signature.

You can sign it as yourself but this won't work on other users machines. You have to sign the InfoPath Web-Enabled template with a domain trusted certificate. Once you do this you should upload the new signed template, then you should be able to open the form without exception.

Hope this helps,


  • 1
    While that is something worth trying, it is definitely NOT required to uploaded a Coded InfoPath form to SharePoint. 90% of my forms both include code and are not signed with a certificate. In fact I have also have one that does require a certificate, but only because it uses hardware on the machine it runs off of.
    – Zork
    May 16, 2012 at 17:49
  • Hi Zork, I had to do this in SharePoint 2007, did this change in 2010? The only way I could get coded solutions to work was with digital signing.
    – Jamie
    May 16, 2012 at 21:02
  • 1
    Interesting, I don't have a tremendous amount of experience with 2007, but yes it is the case in 2010 that you do not need digital signing for all forms. Glad you bring it up, if I ever have to work with a 2007 form I wont end up pulling my hair out!
    – Zork
    May 16, 2012 at 21:13
  • That's great in 2010 then, thanks for pointing that out. I've been avoiding using coded solutions so I don't have to mess about with digital signing.
    – Jamie
    May 17, 2012 at 7:47

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.