B
ben h
Hi,
I have a very simple problem, but I'm lost in the quagmire of documentation.
From VBA, I want to get some info from the SharePoint 2003 / WSS3 Lists web
service (/_vti_bin/Lists.asmx) to retrieve document filenames from a doc
library.
I have the 2003 Web services toolkit, and have created the required class in
VBA. What I need to do next is connect to the web service, then grab all the
files (their filenames will do) from one particular doc library. How do I do
it? I have through other means retrieved the full xml response from the web
service, but I really don't know how to use this class that is created by the
toolkit.
This is what I have:
Sub TestWebServices()
Dim ListService As clsws_Lists
Set ListService = New clsws_Lists
Const DocLibGUID as String = "{F44BF208-B7D7-411C-9F29-84644DD5DB6C}"
Dim nodelist As MSXML2.IXMLDOMNodeList
Dim strListName As String
Dim strViewName As String
Dim nodeQuery As MSXML2.IXMLDOMNodeList
Dim nodeViewFields As MSXML2.IXMLDOMNodeList
Dim nodeQueryOptions As MSXML2.IXMLDOMNodeList
strListName = "Shared Documents"
strViewName = "AllDocuments"
Set nodeQuery = ??? ' how do I initialise these?
Set nodeViewFields = ???
Set nodeQueryOptions = ???
strRowLimit = ??? ' what should this be to return all rows?
Set nodelist = ListService.wsm_GetListItems(DocLibGUID, strViewName,
nodeQuery, nodeViewFields, strRowLimit, nodeQueryOptions)
' what will the above line actually return to me? How will i traverse
through it to get the info I need?
End Sub
Here's a portion of the xml returned by other means:
<soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<GetListItemsResult>
<listitems xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:rs="urn:schemas-microsoft-com:rowset"
xmlns:z="#RowsetSchema">
<rs:data ItemCount="216">
<z:row ows_DocIcon="pdf" ows_LinkFilenameNoMenu="Travel proposals.pdf"
ows_Last_x0020_Modified="259;#2006-08-11 14:41:50" ows_Editor="10;#STOW,
Oliver" ows_ID="259" ows_owshiddenversion="4" ows_FSObjType="259;#0"
ows_FileLeafRef="259;#Travel proposals.pdf" ows_Modified="2006-08-11
14:41:49" ows_FileRef="259;#sites/QMS/Shared Documents/Travel proposals.pdf"/>
....
many more lines like this last one
I have a very simple problem, but I'm lost in the quagmire of documentation.
From VBA, I want to get some info from the SharePoint 2003 / WSS3 Lists web
service (/_vti_bin/Lists.asmx) to retrieve document filenames from a doc
library.
I have the 2003 Web services toolkit, and have created the required class in
VBA. What I need to do next is connect to the web service, then grab all the
files (their filenames will do) from one particular doc library. How do I do
it? I have through other means retrieved the full xml response from the web
service, but I really don't know how to use this class that is created by the
toolkit.
This is what I have:
Sub TestWebServices()
Dim ListService As clsws_Lists
Set ListService = New clsws_Lists
Const DocLibGUID as String = "{F44BF208-B7D7-411C-9F29-84644DD5DB6C}"
Dim nodelist As MSXML2.IXMLDOMNodeList
Dim strListName As String
Dim strViewName As String
Dim nodeQuery As MSXML2.IXMLDOMNodeList
Dim nodeViewFields As MSXML2.IXMLDOMNodeList
Dim nodeQueryOptions As MSXML2.IXMLDOMNodeList
strListName = "Shared Documents"
strViewName = "AllDocuments"
Set nodeQuery = ??? ' how do I initialise these?
Set nodeViewFields = ???
Set nodeQueryOptions = ???
strRowLimit = ??? ' what should this be to return all rows?
Set nodelist = ListService.wsm_GetListItems(DocLibGUID, strViewName,
nodeQuery, nodeViewFields, strRowLimit, nodeQueryOptions)
' what will the above line actually return to me? How will i traverse
through it to get the info I need?
End Sub
Here's a portion of the xml returned by other means:
<soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<GetListItemsResult>
<listitems xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:rs="urn:schemas-microsoft-com:rowset"
xmlns:z="#RowsetSchema">
<rs:data ItemCount="216">
<z:row ows_DocIcon="pdf" ows_LinkFilenameNoMenu="Travel proposals.pdf"
ows_Last_x0020_Modified="259;#2006-08-11 14:41:50" ows_Editor="10;#STOW,
Oliver" ows_ID="259" ows_owshiddenversion="4" ows_FSObjType="259;#0"
ows_FileLeafRef="259;#Travel proposals.pdf" ows_Modified="2006-08-11
14:41:49" ows_FileRef="259;#sites/QMS/Shared Documents/Travel proposals.pdf"/>
....
many more lines like this last one