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");
// See whether the document with the same name already exists in the Windows SharePoint Services (WSS) document library.
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
// in the WSS document library.
if (oXmlHttp.Status == 404)
{
// Put the document in the WSS document library.
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;
}
}
{
// 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");
// See whether the document with the same name already exists in the Windows SharePoint Services (WSS) document library.
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
// in the WSS document library.
if (oXmlHttp.Status == 404)
{
// Put the document in the WSS document library.
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;
}
}