How to Design XML Documents
Aug 27 2:51:29
Back online!
Jul 30 16:17:53
Response to "Knowledge Management 2.0"
Jul 18 2:45:52
Drupal Apps
Jun 3 7:17:00
Google Sites and the AJAX universe
May 21 1:18:39
In response to a question from a reader, Tim, this is a follow-up from an earlier article on SharePoint, SOAP and VBScript. This time, we'll look at how to do more complex calls to SharePoint web services in VBScript
Some web services in SharePoint require passing XML as parameters. Unfortunately, you can't pass an XML document, it has to be an XML node element, and this takes a bit of effort to construct in VBScript.
The example we'll use is making a call to GetListItems, which returns all items in a SharePoint library, optionally matching a query formatted using a special XML syntax.
To correctly call this web service, create a VBScript file with the following lines:
Dim xmlDoc, SOAPClient
Set xmlDoc = CreateObject("MSXML2.DOMDocument.5.0")
xmlDoc.async = False
xmlDoc.loadXML( _
"" + _
" " + "1" + _
" " + _
" " + _
"" )
Set SOAPClient = CreateObject("MSSOAP.SOAPClient")
SOAPClient.mssoapinit
"http://sharepoint.alentus.com/_vti_bin/Lists.asmx?WSDL"
Dim result
Set result = SOAPClient.GetListItems( "Tasks", "", _
xmlDoc.getElementsByTagName("Query"), _
xmlDoc.getElementsByTagName("ViewFields"), "", _
xmlDoc.getElementsByTagName("QueryOptions"), "" )
DisplayNode result.childNodes
There are a number of ways to create and retrieve XML nodes, of course, but this way has the benefit of being fairly concise and self-explanatory.
Comments
Error with GetListItems
Hi,
Great to find this and the other page. However, while the other page retrieves the views this example errors out on SOAPClient.GetListItems. The error I get from VBScript is:-
VBScript runtime error: Invalid procedure call or argument: 'SOAPClient.GetListItems'
Hugh