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)
Syntax
'Declaration
Public Function Add ( _
url As String _
) As SPFolder
'Usage
Dim instance As SPFolderCollection
Dim url As String
Dim returnValue As SPFolder
returnValue = instance.Add(url)
public SPFolder Add(
string url
)
Parameters
- url
Type: System.String
Return value
Type: Microsoft.SharePoint.SPFolder
An SPFolder object that represents the folder.
Examples
The following code example adds a folder to the specified Web site.
Dim site As SPSite = SPControl.GetContextSite(Context)
Dim folders As SPFolderCollection = site.AllWebs("Site_Name").Folders
folders.Add("Folder_Name")
SPSite oSiteCollection = SPContext.Current.Site;
SPFolderCollection collFolders =
oSiteCollection.AllWebs["Site_Name"].Folders;
collFolders.Add("Folder_Name");