Compartir a través de


RecycleBinItemCollection Class

Specifies a collection of Recycle Bin items.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Client.ClientObject
    Microsoft.SharePoint.Client.ClientObjectCollection
      Microsoft.SharePoint.Client.ClientObjectCollection<RecycleBinItem>
        Microsoft.SharePoint.Client.RecycleBinItemCollection

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.RecycleBinItemCollection", ServerTypeId := "{9bfb60cf-1aca-484c-a845-5f2d4ef20865}")> _
Public Class RecycleBinItemCollection _
    Inherits ClientObjectCollection(Of RecycleBinItem)
'Usage
Dim instance As RecycleBinItemCollection
[ScriptTypeAttribute("SP.RecycleBinItemCollection", ServerTypeId = "{9bfb60cf-1aca-484c-a845-5f2d4ef20865}")]
public class RecycleBinItemCollection : ClientObjectCollection<RecycleBinItem>

Examples

This code example displays the title and identifier of the first item in the Recycle Bin of the specified site.

using System;
using Microsoft.SharePoint.Client;

namespace Microsoft.SDK.SharePointFoundation.Samples
{
    class RecycleBinItemCollectionExample
    {
        static void Main()
        {
            string siteUrl = "http://MyServer/sites/MySiteCollection";

            ClientContext clientContext = new ClientContext(siteUrl);
            Site collSite = clientContext.Site;
            RecycleBinItemCollection collRBI = collSite.RecycleBin;

            clientContext.Load(collRBI);
            clientContext.ExecuteQuery();

            if (collRBI.Count > 0)
            {
               RecycleBinItem rbiItem = collRBI[0];
               Console.WriteLine("Title: {0}", rbiItem.Title);
               Console.WriteLine("Item ID: {0}", rbiItem.Id);
            }
            else
            {
               Console.WriteLine("The Recycle Bin is empty.");
            }
        }
    }
}

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

RecycleBinItemCollection Members

Microsoft.SharePoint.Client Namespace