<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Submit Form Programmatically</title><link>https://www.infopathdev.com:443/forums/thread/28774.aspx</link><pubDate>Fri, 16 May 2008 18:43:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:28774</guid><dc:creator>Michael Vasquez</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/28774.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=28774</wfw:commentRss><description>&lt;p&gt;I have search everywhere and there are no examples of how to submit an InfoPath form&amp;nbsp; programmatically.&amp;nbsp; I can do it using the standard method but I want to know how to do it programmatically.&amp;nbsp; Here is what I have so far.&lt;/p&gt;&lt;p&gt;Public Sub FormEvents_Submit(ByVal sender As Object, ByVal e As SubmitEventArgs)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; &amp;#39; If the submit operation is successful, set&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;#39;e.CancelableArgs.Cancel = False&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; Dim bSuccess As Boolean = False&lt;br /&gt;&amp;nbsp;&amp;nbsp; Dim sFirstName As String = MainDataSource.CreateNavigator().SelectSingleNode(&amp;quot;my:SharePointTraining/my:fname&amp;quot;, NamespaceManager).Value&lt;br /&gt;&amp;nbsp;&amp;nbsp; Dim sLastName As String = MainDataSource.CreateNavigator().SelectSingleNode(&amp;quot;my:SharePointTraining/my:lname&amp;quot;, NamespaceManager).Value&lt;br /&gt;&amp;nbsp;&amp;nbsp; Dim sFilename As String = Concat(sLastName, &amp;quot;_&amp;quot;, sFirstName) + &amp;quot;.xml&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp; Dim sUrl As String = &amp;quot;http://nmc-sdca-cdsp07/sites/dfa/imd/tid/Request SharePoint Training/&amp;quot; + sFilename&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; Dim oXmlHttp As New MSXML2.XMLHTTP&lt;br /&gt;&amp;nbsp;&amp;nbsp; Dim Xdoc As New MSXML2.DOMDocument&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;#39; Overwrite the file if it exist&lt;br /&gt;&amp;nbsp;&amp;nbsp; oXmlHttp.open(&amp;quot;DELETE&amp;quot;, sUrl, False)&lt;br /&gt;&amp;nbsp;&amp;nbsp; oXmlHttp.send()&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;#39;Submit document&lt;br /&gt;&amp;nbsp;&amp;nbsp; oXmlHttp.open(&amp;quot;PUT&amp;quot;, sUrl, False)&lt;br /&gt;&amp;nbsp;&amp;nbsp; oXmlHttp.send(Xdoc.xml)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; If oXmlHttp.status = 200 Then &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bSuccess = True &lt;br /&gt;&amp;nbsp;&amp;nbsp; End If&lt;br /&gt;End Sub&amp;nbsp;&lt;br /&gt;&lt;br /&gt;This sample above is has been converted from C# from Microsoft&amp;#39;s site&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;TIA&lt;/p&gt;&lt;p&gt;Mike&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>