SP へRecycleBinItemCollection オブジェクト (sp.js)

の SP のコレクションを表しますRecycleBinItemオブジェクトです。

**適用対象:**apps for SharePoint | SharePoint Foundation 2013 | SharePoint Server 2013

var object = new SP.RecycleBinItemCollection()

メンバー

RecycleBinItemCollectionオブジェクトでは、次のメンバーがあります。

Constructor

RecycleBinItemCollectionオブジェクトでは、次のコンスがあります。

コンストラクター

説明

RecycleBinItemCollection

このメンバーは内部使用のために予約済みです。ユーザーのコードから直接使用されるものではありません。

メソッド

RecycleBinItemCollectionオブジェクトでは、次の方法があります。

メソッド

説明

deleteAll

Permanently deletes all recycle bin items.

getById

Returns the recycle bin item with the specified identifier from the collection.

itemAt

Gets the Recycle bin item at the specified index of the collection.

restoreAll

Restores all recycle bin items to their original locations.

プロパティ

RecycleBinItemCollectionオブジェクトでは、次のプロパティがあります。

プロパティ

説明

childItemType

アイテム

Gets the recycle bin item at the specified index of the collection.

次の例では、現在のサイトのごみ箱にタイトルと、最初の項目の ID を表示するアプリケーション ページの [入力] ボタンを作成します。

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<script type="text/ecmascript" language="ecmascript">

    var recycleItemCollection;
    function runCode() {
        var clientContext = new SP.ClientContext.get_current();
        if (clientContext != undefined && clientContext != null) {
            var site = clientContext.get_site();
            this.recycleItemCollection = site.get_recycleBin();

            clientContext.load(this.recycleItemCollection);
            clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
        }
    }

    function onQuerySucceeded() {
        if (this.recycleItemCollection.get_count() > 0) {
            var item = this.recycleItemCollection.itemAt(0);
            var id = item.get_id();
            var title = item.get_title();
            alert('Title: ' + title + '\n' + 'Item ID: ' + id + '\n');
        }
        Else {
            alert("The Recycle Bin is empty."
        }
    }

    function onQueryFailed(sender, args) {
        alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    }

</script>

    <input id="Button1" type="button" value="Run Code" onclick="runCode()" />

</asp:Content>

他のリソースのエンドポイント

エンドポイント URI 構造

http://<sitecollection>/<site>/_api/web/RecycleBin

HTTP 要求

このリソースには、次の HTTP コマンドがサポートしています。

書式を取得します。

GET http://<sitecollection>/<site>/_api/web/RecycleBin

投稿の書式

POST http://<sitecollection>/<site>/_api/web/RecycleBin