Folder class
SharePoint Online
Represents a folder on a SharePoint Web site.
Namespace: Microsoft.SharePoint.Client
Assembly: Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)
This code example lists the folders on the current website.
using System; using Microsoft.SharePoint.Client; namespace Microsoft.SDK.SharePointFoundation.Samples { class FolderExample { static void Main() { string siteUrl = "http://MyServer/sites/MySiteCollection"; ClientContext clientContext = new ClientContext(siteUrl); Web site = clientContext.Web; FolderCollection collFolder = site.Folders; clientContext.Load(collFolder); clientContext.ExecuteQuery(); Console.WriteLine("The current site contains the following folders:\n\n"); foreach (Folder myFolder in collFolder) Console.WriteLine(myFolder.Name); } } }
Show: