Section 2.13.Delete or Unlink a Shared List


2.13. Delete or Unlink a Shared List

You can remove a list or remove the link between the worksheet list and the SharePoint list through Excel or through code. Deleting a list from the server is a little trickier, however.


Note: As with workspaces, removing and unlinking lists from SharePoint is a basic management task. You need to know this stuff.

2.13.1. How to do it

From Excel, use the List menu to unlink or convert a list to a range. To delete it from the worksheet, select the list and use Clear All.

From code, use these ListObject methods to unlink, unlist, or delete a list:

MethodUse to

Unlink

Remove the link between the worksheet list and the SharePoint list

Unlist

Convert the worksheet list to a range, preserving the list's data

Delete

Delete the worksheet list and all its data


Once you have unlinked a list, you can't relink it. To re-establish the link, you must delete the list and insert it back onto the worksheet from the SharePoint list.

All of these methods affect only the worksheet list. The SharePoint list can only be deleted using the SharePoint site or the Lists web service. To delete the SharePoint list from code, create a web reference to the Lists web service and use the following DeleteList method:

    Dim lws As New clsws_Lists  ' Requires Web reference to     SharePoint  Lists.asmx    lws.wsm_DeleteList ("Excel Objects")

If you delete a SharePoint list, but not the worksheet list that shares it, you get an error when you attempt to refresh or update the worksheet list. You can avoid this by unlinking the worksheet list.

2.13.2. How it works

The Lists web service provides a direct interface to lists stored on the SharePoint server. Excel actually wraps those web service method calls to provide its list-sharing features and objects.

2.13.3. What about...

The following section tells you more about the Lists web service.



    Excel 2003 Programming. A Developer's Notebook
    Excel 2003 Programming: A Developers Notebook (Developers Notebook)
    ISBN: 0596007671
    EAN: 2147483647
    Year: 2004
    Pages: 133
    Authors: Jeff Webb

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net