This is my error:
System.InvalidOperationException
The _Startup or _Shutdown method in this form's code contains one or more calls to members of the Microsoft.Office.Interop.InfoPath.SemiTrust namespace. Calls to this namespace from these methods are not permitted.
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
at Microsoft.Office.Interop.InfoPath.SemiTrust.InfoPathOMHelper.Run(String assemblyFullPathName)
and this is the code I think that is causing the problem:
Public Sub _Startup(ByVal app As Application, ByVal doc As XDocument)
thisXDocument = doc
thisApplication = app
If thisXDocument.DOM.selectSingleNode("/dfs:myFields/my:ApprovalSignatures/my:EmployeeSign").text <> "" Then
Try
Dim strCurrentUser As String = System.Environment.UserName
thisXDocument.DOM.selectSingleNode(
"/dfs:myFields/my:Misc/my:CurrentUser").text = strCurrentUserCatch ex As Exception
End Try
End If
End Sub
The code works fine on my pc, I am using infopath 2007(coding vb.net backward compatible infopath 2003), I have the latest updates, IE 7, running MOSS 2007.
The pc's that are having the issue are using InfoPath 2003, IE 6. The pc's have .net framework 2.0 installed and office 2003 primary interop assemblies installed.
Any suggestions or missing items that need to be installed?