Retrieves a list of deleted folders from the trash bin.
The listDeletedFolders()
function returns a Promise that resolves to information about the specified deleted folders and cursor information.
To retrieve a list of non-deleted folders, use the listFolders()
function.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function listDeletedFolders(
options: ListDeletedFoldersOptions,
): Promise<ListDeletedFoldersResponse>;
Options to use when listing deleted folders from the trash bin.
import { folders } from "wix-media.v2";
async function listDeletedFolders() {
try {
const deletedFolders = await folders.listDeletedFolders();
console.log("Deleted Folders:", deletedFolders);
return deletedFolders;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "folders": [
* {
* "_createdDate": "2023-08-21T09:32:47.000Z",
* "_id": "d4051a6890724365a78678a6208ac37e",
* "_updatedDate": "2023-08-21T09:32:47.000Z",
* "displayName": "family",
* "parentFolderId": "trash-root",
* "state": "DELETED"
* },
* {
* "_createdDate": "2023-08-21T05:34:03.000Z",
* "_id": "302fc049d70c41dea33fa4a27ab481ba",
* "_updatedDate": "2023-08-21T05:34:03.000Z",
* "displayName": "Videos",
* "parentFolderId": "trash-root",
* "state": "DELETED"
* }
* ],
* "nextCursor": {
* "cursors": {
* "next": ""
* },
* "hasNext": false
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.