Share via


Delete Method

The Delete method of the Imaging service removes the specified files and folders (items) from the specified list on the current Web site.

Parameters

strListName   The name of the list in the current site.

strFolder   The relative path from the root of the list to the target folder.

itemFileNames   An array of the name of files and folders (items) to be deleted from the list.

Return Value

A Microsoft.SharePoint.SoapServer.SoapXml object that contains the following:

<results xmlns="http://schemas.microsoft.com/sharepoint/soap/ois/">
  <result name="filename1" deleted="true"/>
  <result name="filename2" deleted="false"/>
  .
  .
  .
</results>

Error Values

The following table shows errors that may be returned by the Delete method.

Error Code Description
0x1 ListNotFound: The requested list is not found.
0x2 IsNotLibrary: The requested list, although found, is not a picture library.
0x3 ItemNotFound: The requested list item is not found.
0x4 FolderNotFound: The requested folder is not found.
0x5 InvalidArgument: One or more arguments are not valid.
0x6 FileExists: The file already exists, and the user doesn't specify the overwrite option.

Example

The following example deletes an image called "Red Figure2.gif" from the "My Pictures" picture library on the site at http://umas01/sites/mynewsite.

Note  This code assumes that the site and the picture library already exist and that you have permissions on the server. If the site and picture library do not exist, see "Create a Site and Picture Library" later in this section.

This example shows how to create the site and the picture library and add the image "Red Figure2.gif" required in the preceding example.

Note  You must be a member of the Administrator site group on the Microsoft Windows SharePoint Services server to be able to add a reference to the Admin Web service and to perform the required actions.

SOAP Request Format

The following is a sample SOAP request. The placeholders shown need to be replaced with actual values.

POST /_vti_bin/imaging.asmx HTTP/1.1
Host: Server_Name
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://schemas.microsoft.com/sharepoint/soap/ois/Delete"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Delete xmlns="http://schemas.microsoft.com/sharepoint/soap/ois/">
      <strListName>string</strListName>
      <strFolder>string</strFolder>
      <itemFileNames>
        <string>string</string>
        <string>string</string>
      </itemFileNames>
    </Delete>
  </soap:Body>
</soap:Envelope>

SOAP Response Format

The following is a sample SOAP response. The placeholders shown will be replaced with actual return values.

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <DeleteResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/ois/">
      <DeleteResult>
        <xsd:schema>schema</xsd:schema>xml</DeleteResult>
    </DeleteResponse>
  </soap:Body>
</soap:Envelope>

Requirements

Platforms: Microsoft Windows Server 2003

Web Reference: http://Server_Name/[sites/][Site_Name/]_vti_bin/Imaging.asmx