How To Submit An InfoPath Form To A Windows SharePoint Services Document Library

xiaoxiao2021-03-06  29

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;

}

}

转载请注明原文地址:https://www.9cbs.com/read-39736.html

New Post(0)