Use the Lists Web Service

SharePoint Services includes the Lists web service for getting at shared lists and their data directly. The Lists web service lets you perform tasks on the server that you cannot otherwise perform through Excel objects. Specifically, you can use the Lists web service to:

  • Add an attachment to a row in a list

  • Retrieve an attachment from a row in a list

  • Delete an attachment

  • Delete a list from a SharePoint server

  • Look up a list GUID

  • Perform queries


I’m jumping ahead a bit here—web services are covered in Chapter 4. You need to know a bit about the Lists web service now because you can’t delete a list from SharePoint or add attachments without it.

How to do it

To use a web service from Visual Basic:

  1. Install the Web Services Toolkit from Microsoft at .

  2. Close and restart Excel.

  3. Open the Visual Basic Editor and select Web References from the Tools menu. Visual Basic displays the Microsoft Office 2003 Web Services Toolkit references dialog.

The SharePoint web services reside in the _vti_bin folder of the SharePoint site. To use the Lists web service:

  1. Display the Microsoft Office 2003 Web Services Toolkit as described above.

  2. Select the Web Service URL option button and type the address of the address using this form: http:// http://sharepointURL/_vti_bin/lists.asmx sharepointURL .

  3. Click Search. The Toolkit should find the Lists web service and display it in the Search Results list.

  4. Select the checkbox beside Lists ...

Get Excel 2003 Programming: A Developer's Notebook now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.