OneDrive/SharePoint — Create folder
OneDrive/SharePoint — Create folder
Section titled “OneDrive/SharePoint — Create folder”Type: msfiles-create-folder · Package: OneDrive / SharePoint v1.0.5 · Output: Dictionary<string,object>
Creates a folder in the drive and returns its data (including the ID), which you will usually use as the target when uploading or moving files.
How it works
Section titled “How it works”It works on the session created with OneDrive/SharePoint — Connect. Pass it in the session parameter, or place this activity inside the body of Connect to inherit it automatically.
If you do not give folderId, the folder is created at the drive root. To nest it, pass the parent folder’s ID.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
name | string | — | Folder name. Without characters not allowed in OneDrive/SharePoint (" * : < > ? / \ |). |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanMicrosoftFilesSession | — | Connect session. Inherited inside Connect’s body. |
folderId | string | — | Parent folder ID. When omitted, the drive root. |
Output
Section titled “Output”Returns a Dictionary<string,object> with the created folder’s data: id, name (the final name, which may carry a number if it already existed), isFolder (true), size, webUrl, parentId, modifiedTime, createdTime and childCount (0). Use folder["id"] as the target folderId in Move, Copy or when creating subfolders.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
No OneDrive/SharePoint session available. Provide 'session' from an msfiles-connect activity, or place this activity inside the Connect activity's body so the session is inherited automatically. | The activity is outside Connect’s body and did not receive session. Place it inside the body or pass session = session. |
'name' is required. | name is empty or its expression returned null. |
itemNotFound (Microsoft Graph, 404) | There is no parent folder with that folderId. |
invalidRequest (Microsoft Graph, 400) | The name has characters that are not allowed. |
Folder creation returned no item. | Microsoft Graph replied without the folder data. Check with List files whether it was created before retrying. |
Example
Section titled “Example”OneDrive/SharePoint — Connect credential = credential("m365-operations") └─ body: OneDrive/SharePoint — Create folder name = "Reports " + DateTime.Now.ToString("yyyy-MM") → output: folder OneDrive/SharePoint — Move id = reportId folderId = folder["id"]Related activities
Section titled “Related activities”- OneDrive/SharePoint — Upload — upload files to the folder.
- OneDrive/SharePoint — Move — move files to the folder.
- OneDrive/SharePoint — List files — list its content.
- All OneDrive / SharePoint activities