Join BoxWorks 2024 to discover what's possible with content and AI!
Register now!Deletes a folder, either permanently or by moving it to the trash.
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
.
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 makes a bad request.
folder_not_empty
: Returned if the folder is not empty. Use the
recursive
query parameter to recursively delete the folder and
its contents.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, or when a folder lock has been
applied to the folder to prevent deletion.
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.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 -i -X DELETE "https://api.box.com/2.0/folders/4353455" \
-H "authorization: Bearer <ACCESS_TOKEN>"
await parentClient.folders.deleteFolderById(folder.id);
parent_client.folders.delete_folder_by_id(folder.id)
await parentClient.Folders.DeleteFolderByIdAsync(folderId: folder.Id);
try await parentClient.folders.deleteFolderById(folderId: folder.id)
// Delete the folder and all its contents
BoxFolder folder = new BoxFolder(api, "id");
folder.delete(true);
client.folder(folder_id='22222').delete()
await client.FoldersManager.DeleteAsync("11111", recursive: true);
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")
}