Function XDocument :: OnSubmitRequest (EventObj)
{
// if the submit Operation is successful, set
// EventObj.returnsTatus = true.
Var fsuccessful = false;
// set the url of the file this you want to subsmit here.
Var strurl = "http://servername/sitename/documentlibraryname/testform.xml";
Try
{
// CREATE AN XMLHTTP OBJECT.
Var oxmlhttp = new activXObject ("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;
}
}