Search.../

getFolder( )

Developer Preview

Gets information from the specified folder in the Media Manager.

Description

The getFolder() function returns a Promise that resolves to information about the specified folder.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function getFolder(folderId: string): Promise<Folder>

getFolder Parameters

NAME
TYPE
DESCRIPTION
folderId
string

Folder ID.

Returns

Information about the folder.

Return Type:

Promise<
Folder
>
NAME
TYPE
DESCRIPTION
_createdDate
Date

Date the folder was created.

_id
string

Folder ID. Generated when a folder is created in the Media Manager.

_updatedDate
Date

Date the folder was updated.

displayName
string

Folder name as it appears in the Media Manager.

parentFolderId
string

ID of the folder's parent folder.
Default: media-root folder.

state
string

State of the folder.

Supported values: "OK", "DELETED".

Was this helpful?

Get a folder

Copy Code
1import { folders } from 'wix-media.v2';
2import { elevate } from 'wix-auth';
3
4/* Sample folderId value: '30ed8f8a8f1e4a99b82c516cb212192f' */
5
6async function myGetFolderFunction(folderId) {
7 try {
8 const elevatedGetFolder = elevate(folders.getFolder);
9 const folder = await elevatedGetFolder(folderId);
10
11 console.log('Successfully retrieved folder:', folder);
12 return folder;
13 } catch (error) {
14 console.error(error);
15 // Handle the error
16 }
17}
18
19/* Promise resolves to:
20 * {
21 * "_createdDate": "2023-08-22T08:31:06.000Z",
22 * "_id": "30ed8f8a8f1e4a99b82c516cb212192f",
23 * "_updatedDate": "2023-08-22T08:31:06.000Z",
24 * "displayName": "test2",
25 * "parentFolderId": "302fc049d70c41dea33fa4a27ab481ba",
26 * "state": "OK"
27 * }
28 */