SharePoint - Find or Create Folder
Return a matching direct child folder when it exists, or create it when it does not.
Current published action version 1.2
When to use it
- Make repeated workflows safe when the same folder may already exist.
- Get a stable Folder ID without treating an existing folder as an error.
Before you start
- A connected Microsoft 365 connection for this HighLevel Location.
- The Drive ID of the approved SharePoint document library.
- The direct child folder name to find or create.
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: |
Folder Namefolder_nameRequired · string | Direct child folder name to find or create. Example: |
Practical workflow
- Opportunity reaches Onboarding
Use the approved library and a stable customer name/key.
- Find or Create Folder
Parent Folder Path: Clients; Folder Name: Example Client. Clients must already exist.
- Keep the customer workspace
Map Folder ID and Web URL to internal fields or later steps; preserve the Drive ID context.
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 |
Createdcreatedboolean | Whether this run created the folder instead of finding an existing one. Use for reporting or branching between newly created and already-existing folders. Example valuefalse |
Folder IDfolder_idstring | Microsoft Graph DriveItem ID of the folder. Map into a later step that needs this folder's Item ID. Example valueexample-folder-id |
Folder Namefolder_namestring | Folder name returned by SharePoint. Use in messages, audit text, or later naming logic. Example valueExample Folder |
Web URLweb_urlstring | SharePoint web link for the resulting file or folder. Use when a later step or staff member needs the SharePoint link. Example valuehttps://contoso.sharepoint.com/sites/Retail/Example%20Folder |
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
- Matches direct folders case-insensitively using Unicode normalization; it does not search descendants.
- The parent path must exist. A file with the required folder name cannot be reused as a folder.
- Folder lookup is bounded to 100 direct-child pages. Two different customers with the same name can reuse the same folder; use a stable unique naming rule.
No general automatic action retry. If creation encounters nameAlreadyExists, it performs one more folder lookup to recover a concurrent creation. A later run reuses a matching folder with Created=false; inspect ambiguous errors before rerunning.
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.