Deletes a folder, either permanently or by moving it to the trash.
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
.
true
Delete a folder that is not empty by recursively deleting the folder and all of its content.
1
Ensures this item hasn't recently changed before making changes.
Pass in the item's last observed etag
value
into this header and the endpoint will fail
with a 412 Precondition Failed
if it
has changed since.
Returns an empty response when the folder is successfully deleted or moved to the trash.
Returns an error if the user does not have the required access to perform the action.
access_denied_insufficient_permissions
: Returned when the
user does not have access to the folder.insufficient_scope
: Returned an error if the application
does not have the right scope to delete folders. Make sure
your application has been configured to read and write all files
and folders stored in Box.Returns an error if the folder could not be found, or the authenticated user does not have access to the folder.
not_found
when the authenticated user does not have access
to the folder.folder_not_empty
: Returned if the folder is not empty. Use the
recursive
query parameter to recursively delete the folder and
its contents.operation_blocked_temporary
: Returned if the folder
is locked due to another move, copy, delete or restore
operation in progress.
The operation can be retried at a later point.
Returns an error when the If-Match
header does not match
the current etag
value of the folder. This indicates that the
folder has changed since it was last requested.
Returns an error when the operation takes longer than 60 seconds. The operation will continue after this response has been returned.
An unexpected client error.
curl -X DELETE https://api.box.com/2.0/folders/4353455 \
-H 'Authorization: Bearer <ACCESS_TOKEN>'
await client.FoldersManager.DeleteAsync("11111", recursive: true);
// Delete the folder and all its contents
BoxFolder folder = new BoxFolder(api, "id");
folder.delete(true);
client.folder(folder_id='22222').delete()
client.folders.delete('12345', {recursive: true})
.then(() => {
// deletion succeeded — no value returned
});
client.folders.delete(folderId: "22222", recursive: true) { result: Result<Void, BoxSDKError>} in
guard case .success = result else {
print("Error deleting folder")
return
}
print("Folder and contents successfully deleted")
}