SharePoint - Create Folder Structure
Find or create a root folder, then ensure a deduplicated set of direct child folders exists underneath it.
Current published action version 1.2
When to use it
- Create a repeatable client or project folder structure in one action.
- Prepare standard direct child folders such as Contracts, Invoices, and Reports.
Before you start
- A connected Microsoft 365 connection for this HighLevel Location.
- The Drive ID of the approved SharePoint document library.
- A root folder name; optional subfolders are entered one per line and are direct children only.
In the connected Location, open your workflow, add this named action, enter the values below, and save. Use the Custom Value Picker for dynamic inputs and earlier action outputs.
Inputs
| Input | How to configure it |
|---|---|
Document Library (Drive ID)drive_idRequired · string | Microsoft Graph Drive ID for the SharePoint document library. The Drive ID identifies the library itself and can be reused across workflow actions. Example: |
Parent Folder Pathparent_folder_pathOptional · string | Folder path inside the selected document library, for example Customers/Acme Ltd. Do not include the document library name. Leave empty to use the document library root. Example: |
Root Folder Nameroot_folder_nameRequired · string | Direct child folder name to find or create. Example: |
SubfolderssubfoldersOptional · textarea | Optional direct child folder names, one per line. Each entry creates a folder directly under the new root folder. Do not use / or \ in these entries. Example: |
Practical workflow
- Customer reaches onboarding
Use a stable customer name and an existing Clients parent.
- Create Folder Structure
Parent Folder Path: Clients; Root Folder Name: Example Client; Subfolders: Contracts, Proposals, Invoices, Deliverables on separate lines.
- Send the workspace link
Map Root Web URL into an internal notification; retain Root Folder ID with its Drive ID.
Run with a dedicated test contact and non-sensitive SharePoint data. Inspect the action result and compare it with the intended library before enabling ordinary contacts. See the complete business recipes for end-to-end configuration.
Expected outputs
| Output | Meaning and use |
|---|---|
Successsuccessboolean | Confirms that the action completed successfully. Use as a completion checkpoint before relying on other outputs. Example valuetrue |
Root Folder IDroot_folder_idstring | DriveItem ID of the root folder. Map into later operations that target the root folder. Example valueexample-root-folder-id |
Root Folder Nameroot_folder_namestring | Name of the root folder. Use in workflow messages or audit text. Example valueClient Files |
Root Web URLroot_web_urlstring | SharePoint web link for the root folder. Use when staff need a direct link to the root folder. Example valuehttps://contoso.sharepoint.com/sites/Retail/Client%20Files |
Created Rootcreated_rootboolean | Whether this run created the root folder. Use for reporting or repeated-run logic. Example valuetrue |
Folder Countfolder_countnumerical | Number of direct child folders returned by the action. Use to confirm how many child folder results were returned. Example value2 |
Foldersfoldersarray | Array of direct child folder results, including IDs, names, links, and created flags. Use the returned child IDs, names, links, and created flags in later logic. Example value[{"id":"example-child-folder-id-1","name":"Contracts","web_url":"https://contoso.sharepoint.com/sites/Retail/Client%20Files/Contracts","created":true},{"id":"example-child-folder-id-2","name":"Invoices","web_url":"https://contoso.sharepoint.com/sites/Retail/Client%20Files/Invoices","created":false}] |
In a later step, select the named output from this action through HighLevel's Custom Value Picker. Retain the Drive ID with an Item/Folder ID. An array such as Items or Folders needs deliberate member selection; it is not a scalar Item ID. Output mapping guidance →
Limits and retry behavior
- One root and direct children only. Subfolder entries must be individual names, not nested paths. Blank lines are ignored and names are deduplicated case-insensitively with Unicode normalization.
- Creation is sequential and has no rollback. An error in a later child can leave the root and earlier children in place.
- Folder Count describes submitted child results, not every child currently in the folder. Lookups are bounded to 100 direct-child pages.
No general automatic action retry. Same-named folders are reused, and a nameAlreadyExists creation race triggers one more lookup. After a partial failure, inspect and correct the cause, then rerun the same stable names to ensure missing folders.
Common errors and recovery
- Missing or invalid input / 400
- A required dynamic value is blank or has an unsupported format. Inspect the resolved value on the enrolled contact; compare with the input format above before retrying.
- Authentication unavailable / 401
- This HighLevel Location does not have a usable Microsoft connection. Verify the Location connection before changing SharePoint permissions.
- 403
- The Entra app lacks access to the selected SharePoint site or the granted role is too narrow for the operation. Verify Sites.Selected consent and the site's write grant.
- 404
- The Drive ID, folder path, or Item ID does not resolve in the connected tenant and approved site. Recheck the administrator's Drive ID map and the exact path or Item ID.
- 429
- Microsoft Graph throttled the request. Retry later and avoid high-volume loops without bounds.
- Conflicting file / partial structure
- A file occupies a required folder name or a child operation failed. Inspect existing items, fix the conflict without deleting unrelated data, then rerun with the same stable names.
Failed requests stop the action; do not rely on Success=false as a returned error contract. Keep secrets and private URLs out of diagnostics. Troubleshooting →
Permissions and security
- Microsoft Graph application permission Sites.Selected on the customer-owned Entra app.
- The SharePoint site containing the document library must grant the app at least write access for this operation.
- The action does not require tenant-wide SharePoint access merely for discovery or name matching.
Runtime access is app-only and does not mirror the permissions of the person enrolling a contact. A Drive ID selects a library inside a granted site; it is not a library-level security grant. Returned Web URLs require the reader's own Microsoft access. Security model →
Related actions
Version and reference review
Current published action: 1.2. Compare with the version in your existing workflow before adopting these fields; older published versions may differ.
Reference reviewed on against application commit 8440a0f. Published versions remain immutable.