Set folder for an Asset

Asset.setParent(assetFolder)

Sets the folder of the current Asset in the Webflow Designer

Syntax

1Asset.setParent(assetFolder: AssetFolder): Promise<null>

Returns

null

A Promise that resolves to null.

Example

1// Get all Assets
2const assets = await webflow.getAllAssets()
3const myAsset = assets[0]
4
5const folders = await webflow.getAllAssetFolders()
6const folder = folders[0]
7
8if (folder) {
9await myAsset.setParent(folder)
10console.log(`Asset: ${myAsset.id} moved to ${folder.id}`)
11} else {
12webflow.notify({ type: 'Error', message: 'Folder not found' })
13}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canManageAssetsAnyAnyAnyAny