I'm just looking to confirm that it is possible to deploy a managed-code form template to InfoPath Forms Services on MOSS 2007 and have it displayed in the browser rather than opening InfoPath when the form makes use of System.DirectoryServices.
As a test, I've followed the steps outlined within http://msdn2.microsoft.com/en-us/library/bb952744.aspx to extract information from Active Directory for the current user. This form works when previewed or debugged from VSTA.
To deploy to SharePoint I've followed the instructions in this rather informative blog posting: http://platinumdogs.wordpress.com/2007/12/17/deploy-an-infopath-2007-form-with-managed-code-to-a-browser-enabled-sharepoint-document-library/
The deployed form will open and display information on the current user successfully from the Form Template Library within SharePoint, but does so using the InfoPath client application.
Finally I created a new Forms Library on a SharePoint site, added my form as a content type and set the option to have the form open in the browser. Unfortunately I receive the following error upon opening the form:
Request for the permission of type 'System.DirectoryServices.DirectoryServicesPermission, System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.
So, to conclude: the form opens in InfoPath without error, but will not open in IE. I'd just like to know if what I'm trying to do is possible, and, if it is, what is likely to be causing the error observed? Is it likely to be a security/trust issue given that the form works in InfoPath? Do browser-enabled forms require higher trust settings to operate than InfoPath client forms? The form is set to automatically assign the trust level.
David.
PS. Just as a test, I tried modifying the .NET Framework 2.0 Configuration to be FullTrust for All_Code on the server hosting SharePoint to see if this fixed anything, however it didn't.