createFolder(folderPath, [folderType]) Last updated: 15. Oct 2026
API only function
Creates a folder from the specified path, including any missing parent folders. Folders that already exist are left as they are.
See also: Path traversal
Parameters
| Name | Type | Description |
|---|---|---|
| folderPath | string | Folder path to create, from the site root. Separate levels with /. |
| folderType (optional) | string | Path to a folder schema (for example "#/Schemas/Project"). Every folder this call creates gets this schema. Throws if the schema is not found (error 77) or is not a folder schema (error 78). |
Returns
An object with Id, Guid and Name for the LAST folder this call created. Returns null when every folder in the path already existed — use getFolder to look the folder up in that case.
Example
Code example (JS)
JS is normal JavaScript either running in the browser or on the Docly™ server.// Ensures the folder path exists, creating any missing levels
let created = docly.createFolder("folder 1/part 2/folder");
// created is null when the folder already existed
let folder = created || docly.getFolder("folder 1/part 2/folder");
write(folder.Guid);