I have search everywhere and there are no examples of how to submit an InfoPath form programmatically. I can do it using the standard method but I want to know how to do it programmatically. Here is what I have so far.
Public Sub FormEvents_Submit(ByVal sender As Object, ByVal e As SubmitEventArgs)
' If the submit operation is successful, set
'e.CancelableArgs.Cancel = False
Dim bSuccess As Boolean = False
Dim sFirstName As String = MainDataSource.CreateNavigator().SelectSingleNode("my:SharePointTraining/my:fname", NamespaceManager).Value
Dim sLastName As String = MainDataSource.CreateNavigator().SelectSingleNode("my:SharePointTraining/my:lname", NamespaceManager).Value
Dim sFilename As String = Concat(sLastName, "_", sFirstName) + ".xml"
Dim sUrl As String = "http://nmc-sdca-cdsp07/sites/dfa/imd/tid/Request SharePoint Training/" + sFilename
Dim oXmlHttp As New MSXML2.XMLHTTP
Dim Xdoc As New MSXML2.DOMDocument
' Overwrite the file if it exist
oXmlHttp.open("DELETE", sUrl, False)
oXmlHttp.send()
'Submit document
oXmlHttp.open("PUT", sUrl, False)
oXmlHttp.send(Xdoc.xml)
If oXmlHttp.status = 200 Then
bSuccess = True
End If
End Sub
This sample above is has been converted from C# from Microsoft's site
TIA
Mike