SP.RecycleBinItemCollection object
Represents a collection of SP.RecycleBinItem objects.
Applies to: apps for SharePoint | SharePoint Foundation 2013 | SharePoint Server 2013
var object = new SP.RecycleBinItemCollection()
Members
The RecycleBinItemCollection object has the following members.
Constructor
The RecycleBinItemCollection object has the following constructor.
Constructor |
Description |
---|---|
This member is reserved for internal use and is not intended to be used directly from your code. |
Methods
The RecycleBinItemCollection object has the following methods.
Method |
Description |
---|---|
Permanently deletes all recycle bin items. |
|
Returns the recycle bin item with the specified identifier from the collection. |
|
Gets the Recycle bin item at the specified index of the collection. |
|
Restores all recycle bin items to their original locations. |
Properties
The RecycleBinItemCollection object has the following properties.
Property |
Description |
---|---|
Gets the recycle bin item at the specified index of the collection. |
Example
The following example creates an input button on an application page that displays the title and ID of the first item in the recycle bin of the current site.
<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>
REST resource endpoint
Endpoint URI structure
http://<sitecollection>/<site>/_api/web/RecycleBin
HTTP requests
This resource supports the following HTTP commands:
GET syntax
GET http://<sitecollection>/<site>/_api/web/RecycleBin
POST syntax
POST http://<sitecollection>/<site>/_api/web/RecycleBin