Sunday 2 December 2012

System.Security.SecurityException was unhandled by user code - InfoPath 2010

Problem:

Sometimes working with InfoPath , in my case its InfoPath - 2010, come across a problem of security exception mentioned below :

System.Security.SecurityException was unhandled by user code
Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=14.0.0.0, Culture=neutral, PublicKeyToken=xxxxxx' failed

This exception arises when we are using some code snippet to communicate with SharePoint in any way. 

Plus would like to mention that when we use any "Manage Data Connection" , and preview our InfoPath form, it usually prompt a message :




Solution:

To solve this problem, you have to switch your InfoPath - 2010 form to Full Trust.
To do that, click "File" , then from menu choose "Info" and then "Form Options", and then uncheck "Automatically determine security level", by default its checked, and it will enable 3 radio buttons below this.
You have to choose "full trust", click OK. 

Now both the above mentioned warnings and exception should not occur.


No comments:

Post a Comment

Test Email without sending Email to User - C# / C-Sharp - DotNet

Sometimes we may want to test email functionality without sending email to actual user. Email will be saved locally so that we can verify ...