Delete Method

The Delete method of the SPFileCollection class deletes the file located at the specified URL.

Parameters

strUrl   A string that contains the URL of the file to delete. For information about the forms of URLs used in Microsoft Windows SharePoint Services, see Guidelines for Using the Object Models.

Example

The following code example iterates through all the files in the Shared Documents document library of every subsite for a site and deletes files that were not modified within the last week.

This example requires using directives (Imports in Visual Basic) for both the Microsoft.SharePoint and Microsoft.SharePoint.WebControls namespaces.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security