{
  "name": "Smart nested folder creation in OneDrive with existence checking",
  "nodes": [
    {
      "id": "1b14115d-eca4-4439-9da0-3c3b0b054b0f",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -1088,
        576
      ]
    },
    {
      "id": "00258e85-bc24-4db6-9e6b-d95a7cdd1eef",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -416,
        576
      ]
    },
    {
      "id": "81016209-22fd-43e2-8dc6-5b3fa5b65b79",
      "name": "Paths",
      "type": "n8n-nodes-base.code",
      "position": [
        -864,
        576
      ]
    },
    {
      "id": "4ecf8424-7677-489f-8e1a-e329b698591f",
      "name": "Search",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "position": [
        32,
        304
      ]
    },
    {
      "id": "9df67617-bcca-4b67-bbbb-b5cf93de6d6a",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -192,
        576
      ]
    },
    {
      "id": "56565cae-85ed-4925-a310-dffa82ce657d",
      "name": "Create a folder",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "position": [
        672,
        704
      ]
    },
    {
      "id": "fa1ed9a0-ecf6-43d7-8c93-6ecc379bae81",
      "name": "Exists",
      "type": "n8n-nodes-base.if",
      "position": [
        192,
        304
      ]
    },
    {
      "id": "bc711dd2-fde2-4ebb-9fb3-1c2f31f9e0dd",
      "name": "setParentFound",
      "type": "n8n-nodes-datastore.datastore",
      "position": [
        400,
        288
      ]
    },
    {
      "id": "ea2026e1-4913-4b4a-9866-8865de7998d8",
      "name": "setParentCreated",
      "type": "n8n-nodes-datastore.datastore",
      "position": [
        896,
        704
      ]
    },
    {
      "id": "f3c29938-238d-4297-80ac-a83ede402a76",
      "name": "getParent",
      "type": "n8n-nodes-datastore.datastore",
      "position": [
        448,
        704
      ]
    },
    {
      "id": "4e3100f1-5d56-4560-8a32-c167f18aa842",
      "name": "clearParent",
      "type": "n8n-nodes-datastore.datastore",
      "position": [
        -640,
        576
      ]
    },
    {
      "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"
      }
    },
    {
      "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 c"
      }
    }
  ],
  "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
          }
        ]
      ]
    }
  }
}