none
InfoPath forms with c# code not work properly in Sharepoint 2010

    คำถาม

  • Hi.

    I've got  an infopath 2010 simple form with C# code in Formevents_Loading and button Click .

    After publishing in a new library in sharepoint 2010 and click Add Document.

    I will recieve :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.

    Microsoft SharePoint Foundation Sandboxed Code Service  is already started.

    When I check 14\logs with the correlation ID I found the results as below :

    05/09/2012 15:32:49.46  SPUCWorkerProcess.exe (0x0254)           0x16D8 SharePoint Foundation          Sandboxed Code Service         fe8s Medium    -  - Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: An unexpected error has occurred. - userCodeWrapperType = "Microsoft.Office.InfoPath.Server.Host.FormServerUserCodeWrapper", userAssemblyGroupId = "DD74C00020D04217AF4604FAF806C4E1-auFdjkxbz4Eofej+rVPSMlI8N5XhgfY73AhegBAGl5g=", siteCollectionId = "41cb60e5-0659-4e67-ae8b-6bdf67b14351" - Inner Exception: Microsoft.SharePoint.UserCode.SPUserCodeSolutionProxiedException: Could not load type 'Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager' from assembly 'Microsoft.SharePoint, Version=14.900.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.    Server stack trace:      at Microsoft.Office.InfoPath.Server.SolutionLifetime.UserHost.GetCurrentUserAccountName(... 6eae1e4a-6fd3-4e8d-96eb-4f88e2491423
    05/09/2012 15:32:49.46* SPUCWorkerProcess.exe (0x0254)           0x16D8 SharePoint Foundation          Sandboxed Code Service         fe8s Medium   ...)     at Microsoft.Office.InfoPath.Server.DocumentLifetime.Document.CreateDocument(HttpContext context, SPSite contextSite, String editingSessionId, Solution solution, String webUrl)     at Microsoft.Office.InfoPath.Server.DocumentLifetime.Document.LoadFromRemoteContext(Boolean firstOpened, String editingSessionId, Solution solution, Byte[] serializedState, Byte[] serializedVersionState, Dictionary`2 inputParams, OpenParameters openParameters)     at Microsoft.Office.InfoPath.Server.Controls.XmlFormView..ctor(Solution solution, RemoteExecutionContext remoteExecutionContext)     at Microsoft.Office.InfoPath.Server.Host.FormServerUserCodeWrapper.Execute(SPUserCodeExecutionContext executionContext)     at Microsoft.SharePoint.UserCode.SPUserCodeApplicationHostAppDomainRef.ExecuteWrapper(SPUse... 6eae1e4a-6fd3-4e8d-96eb-4f88e2491423
    05/09/2012 15:32:49.46* SPUCWorkerProcess.exe (0x0254)           0x16D8 SharePoint Foundation          Sandboxed Code Service         fe8s Medium   ...rCodeWrapper wrapper, SPUserCodeExecutionContext executionContext)     at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)     at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)    Exception rethrown at [0]:      at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)     at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)     at Microsoft.SharePoint.UserCode.SPUserCodeApplicationHostAppDomainRef.CodeToExecuteWrapper.EndInvoke(IAsyncResult result)     at Microsoft.SharePoint.UserCode.SPUserCodeApplicationHostAppDomainRef.... 6eae1e4a-6fd3-4e8d-96eb-4f88e2491423
    05/09/2012 15:32:49.46* SPUCWorkerProcess.exe (0x0254)           0x16D8 SharePoint Foundation          Sandboxed Code Service         fe8s Medium   ...Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext executionContext, Boolean shouldUsageLog, Int32 currentProcessId) 6eae1e4a-6fd3-4e8d-96eb-4f88e2491423
    05/09/2012 15:32:49.48  SPUCHostService.exe (0x1DF4)             0x1874 SharePoint Foundation          Sandboxed Code Service         0000 Medium    -  - Could not load type 'Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager' from assembly 'Microsoft.SharePoint, Version=14.900.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'. - Request executing userSolution Id "dd74c000-20d0-4217-af46-04faf806c4e1" for site collection id " 41cb60e5-0659-4e67-ae8b-6bdf67b14351" has encountered an unhandled exception while executing user code. 6eae1e4a-6fd3-4e8d-96eb-4f88e2491423

    Thank you for your help!
    • แก้ไขโดย Farid Hamed 9 พฤษภาคม 2555 11:06
    9 พฤษภาคม 2555 8:14

คำตอบ

  • Hi Farid,

    Just add your current logged-in account to as Site Collection Administrator in your designated Site Collection.

    or

    Ask your Site Collection Administrator to activate your InfoPath Form Template to designated Site Collection.

    InfoPath Form which have custom code with full trust option on required a Site Collection Administrator permission to activate Form template.

    • เสนอเป็นคำตอบโดย Ankush Kumar Jain 14 พฤษภาคม 2555 2:57
    • ทำเครื่องหมายเป็นคำตอบโดย Emir LiuMicrosoft 17 พฤษภาคม 2555 5:58
    14 พฤษภาคม 2555 2:56

ตอบทั้งหมด