ごみ箱に移動されたファイルを復元します。
元のフォルダが削除されている場合にフォルダの復元先となる新しい親ID(省略可)を指定することができます。
12345
ファイルを表す一意の識別子。
ファイルIDを確認するには、ウェブアプリケーションでファイルにアクセスして、URLからIDをコピーします。たとえば、URLがhttps://*.app.box.com/files/123
の場合、file_id
は123
です。
id,type,name
応答に含める属性のカンマ区切りリスト。このパラメータを使用すると、標準の応答には通常含まれないフィールドをリクエストできます。
このパラメータを指定すると、明示的に指定しない限り標準フィールドは応答に含まれず、リクエストしたフィールドのほかには、簡易版レプリゼンテーションのフィールドしか返されないことに注意してください。
Restored.docx
ファイルの新しい名前(省略可)。
元のフォルダがすでに存在しない場合にファイルの復元先となるフォルダのID(省略可)を指定します。
このIDは、元のフォルダがすでに存在しない場合にのみ使用されることに注意してください。このIDは、元の場所が削除されている場合にファイルの復元先となるフォールバックの場所を指定します。
123
親項目のID
ファイルが復元されたときにファイルオブジェクトを返します。
ファイルの復元先フォルダに対してユーザーがアクセス権限を持っていない場合、またはごみ箱からファイルを復元する権限を持っていない場合は、エラーを返します。
ファイルがごみ箱内にない場合は、エラーを返します。
ファイルの復元先フォルダに同じ名前のファイルが存在する場合は、エラーを返します。
予期しないクライアントエラー。
curl -X POST https://api.box.com/2.0/files/12345 \
-H 'Authorization: Bearer <ACCESS_TOKEN>" '
-H 'Content-Type: application/json'
var requestParams = new BoxFileRequest()
{
Name = "Name in case of conflict",
Parent = new BoxRequestEntity()
{
// File will be placed in this folder if original location no longer exists
Id = "12345"
}
};
BoxFile restoredFile = await client.FilesManager.RestoreTrashedAsync(requestParams);
String fileID = "125367";
String newName = "Presentation 2018 ORIGINAL.pptx";
String newParentID = "98765";
BoxTrash trash = new BoxTrash(api);
// Avoid conflicts at the original location
trash.restoreFile(fileID, newName, newParentID);
file_to_restore = client.file(file_id='11111')
restored_file = client.trash().restore_item(file_to_restore)
print('File ID is {0} and name is {1}'.format(restored_file.id, restored_file.name))
client.files.restoreFromTrash(
'11111',
{
// New name in case of conflict
name: 'New Name',
// File will be placed in this folder if original location no longer exists
parent_id: '0'
})
.then(restoredFile => {
/* trashedFile -> {
type: 'file',
id: '11111',
sequence_id: '2',
etag: '2',
sha1: '4bd9e98652799fc57cf9423e13629c151152ce6c',
name: 'Screenshot_1_30_13_6_37_PM.png',
description: '',
size: 163265,
path_collection:
{ total_count: 1,
entries:
[ { type: 'folder',
id: '0',
sequence_id: null,
etag: null,
name: 'All Files' } ] },
created_at: '2013-01-30T18:43:56-08:00',
modified_at: '2013-01-30T18:44:00-08:00',
trashed_at: null,
purged_at: null,
content_created_at: '2013-01-30T18:43:56-08:00',
content_modified_at: '2013-01-30T18:44:00-08:00',
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' },
owned_by:
{ type: 'user',
id: '33333',
name: 'Example User',
login: 'user@example.com' },
shared_link: null,
parent:
{ type: 'folder',
id: '0',
sequence_id: null,
etag: null,
name: 'All Files' },
item_status: 'active' }
*/
});