Using the custom submit functionality of InfoPath it is possible to submit a form directly to a Windows Sharepoint Form Library using the following code. function XDocument::OnSubmitRequest(eventObj) { // If the submit operation is successful, set // eventObj.ReturnStatus = true var fSuccessful = false; // Set the URL of the file that you want to submit here. var strUrl = "http://ServerName/SiteName/DocumentLibraryName/testform.xml"; try { // Create an xmlhttp object. var oXmlHttp = new ActiveXObject("MSXML2.XMLHTTP"); // Check whether the document with the same name already exists on SharePoint Team Services (STS). oXmlHttp.Open("HEAD", strUrl, false); oXmlHttp.Send(); // No document with the URL has been found. Continue to submit. // If you must replace the original file, you must call // oXmlHttp.Open("DELETE", strUrl, false) to delete the document // on STS first. if (oXmlHttp.Status == 404) { // Put the document on STS. oXmlHttp.Open("PUT", strUrl, false); oXmlHttp.Send(XDocument.DOM.xml); // A 200 status code or a 201 status code indicates that the form has been submitted successfully. if (oXmlHttp.Status == 200 || oXmlHttp.Status == 201) { fSuccessful = true; } } } catch (ex){} if (fSuccessful) { XDocument.UI.Alert("Document submitted successfully!"); eventObj.ReturnStatus = true; } else { eventObj.ReturnStatus = false; } } For more information about this take a look at the following support article. How To: Programmatically Submit an InfoPath Form to a SharePoint Team Services Document Library 10:09:50 PM ![]() |