SP。RecycleBinItem 对象 (sp.js)
表示网站或网站集的回收站中的回收站项目。
**上次修改时间:**2015年3月9日
**适用范围:**apps for SharePoint | SharePoint Foundation 2013 | SharePoint Server 2013
var object = new SP.RecycleBinItem()
成员
RecycleBinItem对象具有以下成员。
构造函数
RecycleBinItem对象具有以下构造函数。
构造函数 |
说明 |
---|---|
Initializes a new instance of the SP.RecycleBinItem object. |
方法
RecycleBinItem对象具有以下方法。
方法 |
说明 |
---|---|
Permanently deletes the Recycle Bin item. |
|
Restores the Recycle Bin item to its original location. |
属性
RecycleBinItem对象具有以下属性。
属性 |
说明 |
---|---|
Gets a value that specifies the user who created the Recycle Bin item. |
|
Gets a value that specifies the user who deleted the Recycle Bin item. |
|
Gets a value that specifies when the Recycle Bin item was moved to the Recycle Bin. |
|
Gets a value that specifies the site relative URL of the list or folder that originally contained the Recycle Bin item. |
|
Gets a value that specifies the identifier of the Recycle Bin item. |
|
Gets a value that specifies the Recycle Bin stage of the Recycle Bin item. |
|
Gets a value that specifies the type of the Recycle Bin item. |
|
Gets a value that specifies the leaf name of the Recycle Bin item. |
|
Gets a value that specifies the size of the Recycle Bin item in bytes. |
|
Gets a value that specifies the title of the Recycle Bin item. |
示例
下面的示例显示当前网站的回收站中的标题和第一个项目的 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(recyclebinitemid)
HTTP 请求
此资源支持以下 HTTP 命令 ︰
删除语法
DELETE http://<sitecollection>/<site>/_api/web/RecycleBin(recyclebinitemid)
文章语法
POST http://<sitecollection>/<site>/_api/web/RecycleBin(recyclebinitemid)