Restores a folder that has been moved to the trash.
An optional new parent ID can be provided to restore the folder to in case the original folder has been deleted.
During this operation, part of the file tree will be locked, mainly the source folder and all of its descendants, as well as the destination folder.
For the duration of the operation, no other move, copy, delete, or restore operation can performed on any of the locked folders.
12345
The unique identifier that represent a folder.
The ID for any folder can be determined
by visiting this folder in the web application
and copying the ID from the URL. For example,
for the URL https://*.app.box.com/folder/123
the folder_id
is 123
.
The root folder of a Box account is
always represented by the ID 0
.
id,type,name
A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response.
Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested.
"Restored Photos"
An optional new name for the folder.
Specifies an optional ID of a folder to restore the folder to when the original folder no longer exists.
Please be aware that this ID will only be used if the original folder no longer exists. Use this ID to provide a fallback location to restore the folder to if the original location has been deleted.
"123"
The ID of parent item
Returns a folder object when the folder has been restored.
Returns an error if the user does not have access to the folder the folder is being restored to, or the user does not have permission to restore folders from the trash.
Returns an error if the folder is not in the trash.
Returned an error if there is a folder with the same name in the destination folder.
operation_blocked_temporary
: Returned if either of the destination
or source folders is locked due to another move, copy, delete or
restore operation in process.
The operation can be retried at a later point.
An unexpected client error.
curl -i -X POST "https://api.box.com/2.0/folders/4353455" \
-H "authorization: Bearer <ACCESS_TOKEN>"
await client.trashedFolders.restoreFolderFromTrash(folder.id);
client.trashed_folders.restore_folder_from_trash(folder.id)
await client.TrashedFolders.RestoreFolderFromTrashAsync(folderId: folder.Id);
String folderID = "125367";
String newName = "My Documents ORIGINAL";
String newParentID = "98765";
BoxTrash trash = new BoxTrash(api);
// Avoid conflicts at the original location
trash.restoreFolder(folderID, newName, newParentID);
folder_to_restore = client.folder(folder_id='22222')
restored_folder = client.trash().restore_item(folder_to_restore)
print(f'Folder ID is {restored_folder.id} and name is {restored_folder.name}')
var requestParams = new BoxFolderRequest()
{
Name = "Name in case of conflict",
Parent = new BoxRequestEntity()
{
// Folder will be placed in this parent folder if original location no longer exists
Id = "12345"
}
};
BoxFolder restoredFolder = await client.FoldersManager.RestoreTrashedFolderAsync(requestParams);
client.folders.restoreFromTrash(
'22222',
{
// New name in case of conflict
name: 'New Name',
// Folder will be placed in this parent folder if the original parent no longer exists
parent_id: '0'
})
.then(restoredFolder => {
/* trashedFolder -> {
type: 'folder',
id: '22222',
sequence_id: '1',
etag: '1',
name: 'Old Files',
created_at: '2013-05-06T22:37:30-07:00',
modified_at: '2013-05-06T22:39:08-07:00',
description: '',
size: 18482,
path_collection:
{ total_count: 1,
entries:
[ { type: 'folder',
id: '0',
sequence_id: null,
etag: null,
name: 'All Files' } ] },
created_by:
{ type: 'user',
id: '33333',
name: 'Example User',
login: 'user@example.com' },
modified_by:
{ type: 'user',
id: '33333',
name: 'Example User',
login: 'user@example.com' },
trashed_at: null,
purged_at: null,
content_created_at: '2013-05-06T22:37:30-07:00',
content_modified_at: '2013-05-06T22:39:08-07:00',
owned_by:
{ type: 'user',
id: '33333',
name: 'Example User',
login: 'user@example.com' },
shared_link: null,
folder_upload_email: null,
parent:
{ type: 'folder',
id: '0',
sequence_id: null,
etag: null,
name: 'All Files' },
item_status: 'active' }
*/
});
{
"id": "123456789",
"type": "folder",
"content_created_at": "2012-12-12T10:53:43-08:00",
"content_modified_at": "2012-12-12T10:53:43-08:00",
"created_at": "2012-12-12T10:53:43-08:00",
"created_by": {
"id": "11446498",
"type": "user",
"login": "ceo@example.com",
"name": "Aaron Levie"
},
"description": "Legal contracts for the new ACME deal",
"etag": "1",
"folder_upload_email": "null",
"item_status": "active",
"modified_at": "2012-12-12T10:53:43-08:00",
"modified_by": {
"id": "11446498",
"type": "user",
"login": "ceo@example.com",
"name": "Aaron Levie"
},
"name": "Contracts",
"owned_by": {
"id": "11446498",
"type": "user",
"login": "ceo@example.com",
"name": "Aaron Levie"
},
"parent": {
"id": "12345",
"type": "folder",
"etag": "1",
"name": "Contracts",
"sequence_id": "3"
},
"path_collection": {
"entries": [
{
"id": "12345",
"etag": "1",
"type": "folder",
"sequence_id": "3",
"name": "Contracts"
}
],
"total_count": 1
},
"purged_at": "null",
"sequence_id": "3",
"shared_link": "null",
"size": 629644,
"trashed_at": "null"
}