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.
0
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.
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 -X GET https://api.box.com/2.0/folders/4353455 \
-H 'Authorization: Bearer <ACCESS_TOKEN>'
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);
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('Folder ID is {0} and name is {1}'.format(restored_folder.id, restored_folder.name))
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' }
*/
});