Udostępnij za pośrednictwem


Folder Class

Represents a folder on a SharePoint Web site.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Client.ClientObject
    Microsoft.SharePoint.Client.Folder

Namespace:  Microsoft.SharePoint.Client
Assemblies:   Microsoft.SharePoint.Client.Silverlight (in Microsoft.SharePoint.Client.Silverlight.dll);  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)

Syntax

'Declaration
<ScriptTypeAttribute("SP.Folder", ServerTypeId := "{dbe8175a-505d-4eff-bec4-6c809709808b}")> _
Public Class Folder _
    Inherits ClientObject
'Usage
Dim instance As Folder
[ScriptTypeAttribute("SP.Folder", ServerTypeId = "{dbe8175a-505d-4eff-bec4-6c809709808b}")]
public class Folder : ClientObject

Remarks

The UniqueContentTypeOrder property is not included in the default scalar property set for this type.

Examples

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);
        }
    }
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Folder Members

Microsoft.SharePoint.Client Namespace