This workflow corresponds to n8n.io template #7415 — we link there as the canonical source.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "bfA4a1LwJVx6G5kB",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Create folder in OneDrive",
"tags": [],
"nodes": [
{
"id": "1b14115d-eca4-4439-9da0-3c3b0b054b0f",
"name": "When Executed by Another Workflow",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
-1088,
576
],
"parameters": {
"workflowInputs": {
"values": [
{
"name": "folder"
}
]
}
},
"notesInFlow": false,
"typeVersion": 1.1
},
{
"id": "00258e85-bc24-4db6-9e6b-d95a7cdd1eef",
"name": "Split Out",
"type": "n8n-nodes-base.splitOut",
"position": [
-416,
576
],
"parameters": {
"options": {},
"fieldToSplitOut": "paths"
},
"typeVersion": 1
},
{
"id": "81016209-22fd-43e2-8dc6-5b3fa5b65b79",
"name": "Paths",
"type": "n8n-nodes-base.code",
"position": [
-864,
576
],
"parameters": {
"jsCode": "const folder = $input.first().json.folder || \"Foobar/Barfur/Furbar\";\n\nreturn {\n paths: folder.split('/').map((folder, index, arr) => ({\n name: folder,\n path: `/drive/root:/${arr.slice(0, index + 1).join('/')}`,\n parentId: null,\n parent: index === 0 ? \"/drive/root:\" : `/drive/root:/${arr.slice(0, index).join('/')}`\n }))\n};"
},
"typeVersion": 2
},
{
"id": "4ecf8424-7677-489f-8e1a-e329b698591f",
"name": "Search",
"type": "n8n-nodes-base.microsoftOneDrive",
"position": [
32,
304
],
"parameters": {
"query": "={{ $json.name }}",
"resource": "folder",
"operation": "search"
},
"credentials": {
"microsoftOneDriveOAuth2Api": {
"name": "<your credential>"
}
},
"notesInFlow": false,
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "9df67617-bcca-4b67-bbbb-b5cf93de6d6a",
"name": "Loop Over Items",
"type": "n8n-nodes-base.splitInBatches",
"position": [
-192,
576
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "56565cae-85ed-4925-a310-dffa82ce657d",
"name": "Create a folder",
"type": "n8n-nodes-base.microsoftOneDrive",
"position": [
672,
704
],
"parameters": {
"name": "={{ $('Split Out').item.json.name }}",
"options": {
"parentFolderId": "={{ $json.value || null }}"
},
"resource": "folder",
"operation": "create"
},
"credentials": {
"microsoftOneDriveOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "fa1ed9a0-ecf6-43d7-8c93-6ecc379bae81",
"name": "Exists",
"type": "n8n-nodes-base.if",
"position": [
192,
304
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "186ba457-5540-46bd-b582-7caf6173cfd1",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.id }}",
"rightValue": ""
},
{
"id": "8a0a1ee3-27c7-443b-bf9a-58528bf620d1",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.parentReference.path }}",
"rightValue": "={{ $('Loop Over Items').item.json.parent }}"
}
]
}
},
"typeVersion": 2.2,
"alwaysOutputData": false
},
{
"id": "bc711dd2-fde2-4ebb-9fb3-1c2f31f9e0dd",
"name": "setParentFound",
"type": "n8n-nodes-datastore.datastore",
"position": [
400,
288
],
"parameters": {
"keyName": "parentID",
"valueString": "={{ $('Search').item.json.id }}"
},
"typeVersion": 1
},
{
"id": "ea2026e1-4913-4b4a-9866-8865de7998d8",
"name": "setParentCreated",
"type": "n8n-nodes-datastore.datastore",
"position": [
896,
704
],
"parameters": {
"keyName": "parentID",
"valueString": "={{ $json.id }}"
},
"typeVersion": 1
},
{
"id": "f3c29938-238d-4297-80ac-a83ede402a76",
"name": "getParent",
"type": "n8n-nodes-datastore.datastore",
"position": [
448,
704
],
"parameters": {
"keyName": "parentID",
"operation": "get"
},
"typeVersion": 1
},
{
"id": "4e3100f1-5d56-4560-8a32-c167f18aa842",
"name": "clearParent",
"type": "n8n-nodes-datastore.datastore",
"position": [
-640,
576
],
"parameters": {
"keyName": "parentID",
"operation": "clear"
},
"typeVersion": 1
},
{
"id": "7fd2d1f9-7cf5-415b-a574-8f803edda11a",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
416,
592
],
"parameters": {
"width": 640,
"height": 336,
"content": "## Create folder if it does not exist\n\nPass the ID of created folder forward and store it"
},
"typeVersion": 1
},
{
"id": "38a438a1-9d6e-45e5-a83c-849d6b10b030",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1072,
144
],
"parameters": {
"width": 528,
"height": 400,
"content": "## Create a nested folder in Microsoft OneDrive\n\n- This workflow loops you nested folder e.g. `Foobar/Barfur/Furbar` and creates folders one by one if they don't exist\n- This is because OneDrive API call can do it only like that\n\n## Testing\n\n- \"Paths\" Node has a default value `Foobar/Barfur/Furbar`\n\n## Usage\n\n- Execute this workflow a Sub-workflow and pass your nested folder as `$folder` input variable"
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "7ee0fe9b-34e0-4d03-a775-3d2c83c4f9a3",
"connections": {
"Paths": {
"main": [
[
{
"node": "clearParent",
"type": "main",
"index": 0
}
]
]
},
"Exists": {
"main": [
[
{
"node": "setParentFound",
"type": "main",
"index": 0
}
],
[
{
"node": "getParent",
"type": "main",
"index": 0
}
]
]
},
"Search": {
"main": [
[
{
"node": "Exists",
"type": "main",
"index": 0
}
]
]
},
"Split Out": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"getParent": {
"main": [
[
{
"node": "Create a folder",
"type": "main",
"index": 0
}
]
]
},
"clearParent": {
"main": [
[
{
"node": "Split Out",
"type": "main",
"index": 0
}
]
]
},
"setParentFound": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Create a folder": {
"main": [
[
{
"node": "setParentCreated",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "Search",
"type": "main",
"index": 0
}
]
]
},
"setParentCreated": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"When Executed by Another Workflow": {
"main": [
[
{
"node": "Paths",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
microsoftOneDriveOAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow contains community nodes that are only compatible with the self-hosted version of n8n. It creates a nested folder in your OneDrive's My Files You could be creating folders like:
Source: https://n8n.io/workflows/7415/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Agendamiento. Uses n8n-nodes-evolution-api, redis, dataTable, executeWorkflowTrigger. Event-driven trigger; 60 nodes.
Prevent concurrent workflow runs using Redis. Uses executeWorkflowTrigger, manualTrigger, stickyNote, executeWorkflow. Event-driven trigger; 43 nodes.
This workflow sets a small "lock" value in Redis so that only one copy of a long job can run at the same time. If another trigger fires while the job is still busy, the workflow sees the lock, stops e
Reputation Engine — Site Refresh. Uses httpRequest, executeWorkflowTrigger. Event-driven trigger; 35 nodes.
Using n8n a lot?