SharePoint Web Services query

This VBScript code allows you to query and post just about any information to SharePoint using web services. There are two steps involved:

  1. Check the signature of the Web Service you want to invoke. For example, http://sharepoint/_vti_bin/Lists.asmx will give a list of all operations you can perform on SharePoint lists.
  2. Create a VBScript file with the following lines:

    Option Explicit
    
    Dim xmlDoc, SOAPClient
    
    ' Get the root element object
    Set SOAPClient = createobject("MSSOAP.SOAPClient")
    SOAPClient.mssoapinit "http://sharepoint/_vti_bin/Views.asmx?WSDL"
    Set xmlDoc = SOAPClient.web-service-name(param1, param2, ...)
    
    DisplayNode xmlDoc
    


    (Note that DisplayNode is a VBScript Sub to pretty-print the XML result of the query.)

As an example, we're going to use two web services to determine a View ID and then get the details of that view:

get-view-list.vbs

Dim xmlDoc, SOAPClient

' Get the root element object
Set SOAPClient = createobject("MSSOAP.SOAPClient")
SOAPClient.mssoapinit "http://sharepoint/_vti_bin/Views.asmx?WSDL"
Set xmlDoc = SOAPClient.GetViewCollection("Calendar")

DisplayNode xmlDoc

get-view.vbs

Dim xmlDoc, SOAPClient

' Get the root element object
Set SOAPClient = createobject("MSSOAP.SOAPClient")
SOAPClient.mssoapinit "http://sharepoint/_vti_bin/Views.asmx?WSDL"
Set xmlDoc = SOAPClient.GetView("Calendar", _
  "{4D42A55C-E166-42CE-B339-FD7895F690BD}")

DisplayNode xmlDoc