Partilhar via


SPFolderCollection.Delete Method

Deletes the folder that is located at the specified URL from the collection.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Sub Delete ( _
    strUrl As String _
)
'Usage
Dim instance As SPFolderCollection
Dim strUrl As String

instance.Delete(strUrl)
public void Delete(
    string strUrl
)

Parameters

Remarks

This method deletes the folder that is located at the URL specified by the strUrl parameter from the folder collection, and sets the parent folder of the collection as modified.

Examples

This code example deletes a folder from the specified subsite.

Dim siteCollection As SPSite = SPControl.GetContextSite(Context)
Dim folders As SPFolderCollection = 
    siteCollection.AllWebs("Site_Name").Folders

folders.Delete("Folder_Name") 
SPSite oSiteCollection = SPContext.Current.Site;

SPFolderCollection collFolders = 
    oSiteCollection.AllWebs["Site_Name"].Folders;

collFolders.Delete("Folder_Name");

See Also

Reference

SPFolderCollection Class

SPFolderCollection Members

Microsoft.SharePoint Namespace