InfoPath and Windows 7: System.Security.SecurityException

I’ve recently gone onto Windows 7, and, like every one else it seems, I’m pretty happy with it. Only thing I have found is that using Managed Code in InfoPath 2007 now requires the form to be fully trusted.

It used to be the case that on your own machine, you could allow the form manage it’s own trust level whilst developing with managed code. However, this has changed in Windows 7 – and you may get the error shown below:


Request failed.
   at Microsoft.Office.InfoPath.MsxmlNavigator.IsValidNode(MsxmlNode test)
   at Microsoft.Office.InfoPath.MsxmlNavigator.MoveToFirstChild()
   at MS.Internal.Xml.XPath.XPathChildIterator.MoveNext()
   at MS.Internal.Xml.XPath.ChildrenQuery.Advance()
   at MS.Internal.Xml.XPath.ChildrenQuery.Advance()
   at MS.Internal.Xml.XPath.ChildrenQuery.Advance()
   at MS.Internal.Xml.XPath.XPathSelectionIterator.MoveNext()
   at System.Xml.XPath.XPathNavigator.SelectSingleNode(XPathExpression expression)
   at System.Xml.XPath.XPathNavigator.SelectSingleNode(String xpath, IXmlNamespaceResolver resolver)
   at ContactForm.FormCode.SubmitToList()
   at ContactForm.FormCode.cmdSubmit_Clicked(Object sender, ClickedEventArgs e)
   at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent)
   at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)


To fix this, the form needs to fully trusted:

image  -> image



A minor annoyance, but hopefully it might save you guys some time…



4 thoughts on “InfoPath and Windows 7: System.Security.SecurityException

  1. Making a form full trust should be a last resort when you absolutely need it, e.g. to access files on the client filesystem or perform other “full trust” activities.

    Using the XPathNavigator (which is causing the error here) is not a full trust situation, but this is an issue in .NET 3.5.

    Apparently the fix for this is to install Office 2007 SP2, and I think that would be preferable to making all of your managed code forms full trust.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

About davros85

SharePoint / Azure Architect & Developer - Creator of ProvisionPoint, a site provisioning and change management solution for SharePoint Online