An unhandled exception has occurred in the form's code

Source: Internet
Author: User
S when you use custom Code When loading data to infopath, if:

An unhandled exception has occurred in the form's code

System. Security. securityexception
Request for the permission of Type 'Microsoft. Sharepoint. Security. sharepointpermission, Microsoft. Sharepoint. Security, version = 12.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c' failed.
At system. Security. codeaccesssecurityengine. throwsecurityexception (Assembly ASM, permissionset granted, permissionset refused, runtimemethodhandle rmh, securityaction action, object demand, ipermission permthatfailed)
At system. Security. codeaccesssecurityengine. throwsecurityexception (Object assemblyorstring, permissionset granted, permissionset refused, runtimemethodhandle rmh, securityaction action, object demand, ipermission permthatfailed)
At system. Security. codeaccesssecurityengine. checksethelper (permissionset grants, permissionset refused, permissionset demands, runtimemethodhandle rmh, object assemblyorstring, securityaction action, Boolean throwexception)
At system. Security. codeaccesssecurityengine. checksethelper (compressedstack CS, permissionset grants, permissionset refused, permissionset demans, runtimemethodhandle rmh, assembly ASM, securityaction action Action)
At formusercodeloaddata. formcode. formevents_loading (Object sender, loadingeventargs E)
At Microsoft. Office. infopath. Internal. formeventshost. onload (docreturnevent pevent)
At Microsoft. Office. InterOP. infopath. semitrust. _ x?enteventsink2_sinkhelper.onload (docreturnevent pevent)

The most likely reason is that you have not set the trust level. You need to set it in the infopath form:

  • InToolsMenu, clickForm options.

  • InCategoryList, clickSecurity and trust.

  • InSecurity level, ClearAutomatically determine security level.

  • SelectFull TrustAnd then clickOK.

  •  

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.