Project Description
VBA Class Libraries for SharePoint SOAP Communication without usage of the outdated Web Services/SOAP Toolkit.

Library is based on the MSXML Core Services 3.0


WSDL Class Generator

Originally I wanted to use perl to dynamically generate the VBA code from a wsdl, but finally ended up using .NET Web Services interface and reflection to generate the parsing tree to build the cls code..

This has the disadvantage to contract the service within c# before being able to build the VBA code.

 
VBA Integration

Either include SPSoap.cls in your project or start by using the Example project. Also ensure a reference to MS XML, v3.0 exists. The following sample code shows how to access a SharePoint List and Display some results.

VBA Example


Sub LoadData()

' Initialize SPSoap
Dim ws As New SPSoap
Call ws.init("http://schoen.pri:84")

' Initialize variables
Dim Query As IXMLDOMNodeList
Dim viewFields As IXMLDOMNodeList
Dim Result As IXMLDOMNodeList

Dim xdoc As New DOMDocument
xdoc.LoadXML _
("<Document>" & _
" <Query><OrderBy><FieldRef Name='Title'/></OrderBy></Query>" & _
" <ViewFields><FieldRef Name='ID'/><FieldRef Name='Title'/></ViewFields>" & _
" <QueryOptions/>" & _
"</Document>")

Set Query = xdoc.getElementsByTagName("Query")
Set viewFields = xdoc.getElementsByTagName("ViewFields")

Set Result = ws.wsm_GetListItems _
("MasterProcess", "", Query, viewFields, "", Nothing, "")

' Evaluate Resultset
Dim root As IXMLDOMElement
Dim Items As IXMLDOMNodeList
Set root = Result.item(0)

Dim elements As Variant
Set elements = root.getElementsByTagName("rs:data")

Dim strQuery: strQuery = ".//z:row"

Set Items = root.SelectNodes(strQuery)
Debug.Print "No of Items: " & Items.Length
Dim item As Variant

For Each item In Items
Debug.Print "ID: " & item.getAttribute("ows_ID")
Debug.Print "Title: " & item.getAttribute("ows_Title")
Next

End Sub


 

Manual Building Steps

Run SPSOAP.exe. This tool outputs the function definitions integrated in SPSoap.cls