Export (0) Print
Expand All

SPFolderCollection.Add method

Adds the folder that is located at the specified URL to the collection.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public SPFolder Add(
	string url
)

Parameters

url
Type: System.String

Return value

Type: Microsoft.SharePoint.SPFolder
An SPFolder object that represents the folder.

The following code example adds a folder to the specified Web site.

SPSite oSiteCollection = SPContext.Current.Site;
SPFolderCollection collFolders = 
    oSiteCollection.AllWebs["Site_Name"].Folders;
collFolders.Add("Folder_Name");
Show:
© 2014 Microsoft