About InfoPath Forms Services and Business Logic Assemblies

Custom business logic is supported in a browser-enabled form template if it uses the supported types and members of the new managed code object model. The Microsoft Visual Studio Tools for Applications (VSTA) and Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System development environments provide support for the Visual Basic and Visual C# languages, but any language can be used as long as it targets the new object model or is supported by the .NET Framework 2.0.

JScript, VBScript, and managed code using the Microsoft.Office.Interop.InfoPath.SemiTrust object model introduced with Microsoft Office InfoPath 2003 with Service Pack 1, are not supported on a server running InfoPath Forms Services.

The New Managed Code Object Model

The new managed code object model uses the System.Xml.XPath.XPathNavigator class for navigating and updating XML data stores, and the Windows SharePoint Services 3.0 technology that InfoPath Forms Services is built upon requires the .NET Framework 2.0. For detailed information about the new managed code object model and the deprecated object models that can be used with Microsoft Office InfoPath 2007, see Understanding InfoPath 2007 Object Models and Development Environments located in the InfoPath 2007 Developer Reference for Managed Code Form Templates, which is available within the Visual Studio Tools for Applications (VSTA) Help system.

For more information about the subset of the new managed code object model that contains the types and members that can be used in both InfoPath and in a Web browser, see Design-Once Feature Compatibility. It is possible to programmatically determine the runtime environment in order to change custom business logic based on whether the form is opened in InfoPath, a desktop Web browser, or on a mobile browser. For more information about determining the runtime environment, see How to: Write Conditional Logic That Determines the Run-time Environment located in the VSTA Help system.

Security and Performance

When you create a browser-compatible form template, the default InfoPath form code file will be signed with the InfoPath.snk strong name key file. You can use a different strong-named key file for your business logic assemblies. If the default form code file or any supporting assemblies are not strong-named and signed and the form template containing the business logic assembly is upgraded, the SharePoint Application Domain (AppDomain) must be recycled.

InfoPath business logic assemblies are granted permissions through the Code Access Security (CAS) policy resolution. The domain-new trust level on the server is an equivalent concept to the domain trust level on the client. SharePoint includes three policy files: Minimal, Medium, and Full. InfoPath Forms Services gives business logic assemblies corresponding evidence so they map to a code group defined in the policy file and get the right permission set. This permission set is given to the business logic assembly when it is loaded into the ASP.NET Application Domain, but in most cases will not be exactly what the same assembly will receive when the form template containing the custom business logic assembly is opened in InfoPath. In order to ensure that a form template can be opened in InfoPath and in a browser, when a business logic assembly makes object model calls or when InfoPath Forms Services sends events to the business logic assembly, the permission set is elevated or reduced as appropriate to achieve the correct level. Furthermore, if an InfoPath form template contains multiple assemblies, all assemblies are loaded at the same time to ensure a consistent permission set is applied.

Note

Only Full Trust form templates can contain code that dynamically creates assemblies on a server running InfoPath Forms Services.

Every business logic assembly from all browser-enabled form templates on servers running InfoPath Forms Services are loaded, as necessary, into the single Application Domain that SharePoint uses and controls. When the Application Domain is recycled, business logic assemblies are not reloaded until they are requested again.

Business logic assemblies are stored on each front-end Web server and loaded by InfoPath Forms Services using the Assembly.LoadFrom(String) method of the System.Reflection.Assembly .NET Framework class, which includes semantics to merge the input evidence with the evidence gathered by the loader to create a final set of evidence used for policy resolution.

Notes About Using and Referencing Assemblies

  • If you need to share assemblies among multiple form templates, put the shared assemblies into each form template. Be aware, however, that if a second or subsequent form template uses the same assembly but is marked with a higher or lower security level, the shared assembly will inherit the corresponding Application Domain permission set of the first form template's security level.

  • A form containing custom business logic assemblies will fail conversion if any of the form assemblies have the same identity as an assembly in a form that has already been converted and the assemblies do not compare bitwise.