{
  "name": "Automatic Microsoft Outlook attachment storage to OneDrive with Excel logging + BillionVerify",
  "nodes": [
    {
      "id": "2",
      "name": "Get Attachments",
      "type": "n8n-nodes-base.microsoftOutlook",
      "position": [
        432,
        0
      ],
      "parameters": {
        "resource": "messageAttachment",
        "messageId": "={{ $json.messageId }}",
        "operation": "getAll",
        "returnAll": true,
        "additionalFields": {}
      },
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "id": "0J1PXL4u3KlXxSdm",
          "name": "Microsoft Outlook account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4",
      "name": "Upload to OneDrive",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "position": [
        1328,
        16
      ],
      "parameters": {
        "fileName": "={{ $json.name }}",
        "parentId": "={{ $('Get Folder ID').item.json.id }}",
        "binaryData": true
      },
      "credentials": {
        "microsoftOneDriveOAuth2Api": {
          "id": "e6XB76qoACE7B11l",
          "name": "Microsoft Drive account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5",
      "name": "Append to Excel Log",
      "type": "n8n-nodes-base.microsoftExcel",
      "position": [
        1712,
        16
      ],
      "parameters": {
        "table": "{D43EA299-40EE-4A34-87F6-9E927433D04F}",
        "resource": "table",
        "workbook": "01P4ZWQG4WSZOW2LY7FFD2DORNAFD6GUYR",
        "worksheet": "{00000000-0001-0000-0000-000000000000}",
        "additionalFields": {}
      },
      "credentials": {
        "microsoftExcelOAuth2Api": {
          "id": "LrnHjIHURfzDACey",
          "name": "Microsoft Excel account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2b17a075-4c2d-4988-ab30-6b8da0e89d84",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        640,
        0
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "5fd3ff1e-1a3c-4456-a39d-b0009095f58a",
      "name": "Get Message ID",
      "type": "n8n-nodes-base.set",
      "position": [
        240,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "456d9aff-42d5-4d62-8b42-8b4c50aedbd9",
              "name": "messageId",
              "type": "string",
              "value": "={{$json[\"id\"]}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "cda46c7a-97d3-495a-8450-464ce59033a0",
      "name": "On Mail Received",
      "type": "n8n-nodes-base.microsoftOutlookTrigger",
      "position": [
        32,
        0
      ],
      "parameters": {
        "output": "fields",
        "filters": {},
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "id": "J11T8f8mMdP3LOZj",
          "name": "Microsoft Outlook account 3"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "7",
      "name": "Notify User",
      "type": "n8n-nodes-base.microsoftTeams",
      "position": [
        928,
        -192
      ],
      "parameters": {
        "chatId": "19:1a6a7e2d-7f6b-40f2-b982-30a1af96e5bc_cf28171e-fcfd-47e4-a1d6-79460b0b3ca0@unq.gbl.spaces",
        "message": "Attachment has been uploaded",
        "options": {},
        "resource": "chatMessage"
      },
      "credentials": {
        "microsoftTeamsOAuth2Api": {
          "id": "EIvRUfEMfZZoE9QG",
          "name": "Microsoft Teams account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5a5f0f1e-11cc-48c9-a88c-1f9ac705d69a",
      "name": "Get Folder ID",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "position": [
        928,
        16
      ],
      "parameters": {
        "query": "Testn8n",
        "resource": "folder",
        "operation": "search"
      },
      "credentials": {
        "microsoftOneDriveOAuth2Api": {
          "id": "e6XB76qoACE7B11l",
          "name": "Microsoft Drive account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "898ecd52-4b26-4963-af73-7a3140881335",
      "name": "Download Attachment",
      "type": "n8n-nodes-base.microsoftOutlook",
      "position": [
        1120,
        16
      ],
      "webhookId": "f5153b20-4fbf-4221-b712-dd989d3d43a4",
      "parameters": {
        "resource": "messageAttachment",
        "messageId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Get Message ID').item.json.messageId }}"
        },
        "operation": "download",
        "attachmentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Loop Over Items').item.json.id }}"
        }
      },
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "id": "J11T8f8mMdP3LOZj",
          "name": "Microsoft Outlook account 3"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "36a5d459-5b6d-48eb-9a06-2019fc0521b7",
      "name": "Set Filename",
      "type": "n8n-nodes-base.set",
      "position": [
        1520,
        16
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "83ef74a8-15df-4bf7-8f36-bd9d4d6c1bb1",
              "name": "Filename",
              "type": "string",
              "value": "={{ $json.name }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f0f1d810-6045-425e-9716-8ce8f555f701",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1184,
        256
      ],
      "parameters": {
        "color": 4,
        "width": 448,
        "height": 176,
        "content": "## 💾 File Processing\nEach attachment is handled one by one:\n- “Download Attachment” fetches it from Outlook.  \n- “Get Folder ID” finds the correct OneDrive folder.  \n- “Upload to OneDrive” saves the file there.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "600f99de-c6c7-461d-8ee3-01a17bfd6b9e",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        -560
      ],
      "parameters": {
        "width": 960,
        "height": 480,
        "content": "# 📥 Save Email Attachments to OneDrive & Log in Excel\n\nThis workflow watches your Outlook inbox and saves every file attachment into a OneDrive folder, then adds the filename to an Excel log. It helps finance or operations teams store invoices automatically and keep records up to date.\n\n**How it works**\n1. Outlook trigger starts when a new email arrives.\n2. Attachments are fetched and looped through.\n3. Each file is downloaded, uploaded to OneDrive, and logged in Excel.\n4. A Teams message confirms success (optional).\n\n**Setup**\n- Connect Outlook, OneDrive, Excel, and optionally Teams.\n- Adjust the folder name in “Get Folder ID”.\n- Make sure your Excel table has a `Filename` column.\n- Activate the workflow — new attachments will be processed automatically.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "847765b5-01c9-42f0-b808-764be7959f20",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        224
      ],
      "parameters": {
        "color": 5,
        "width": 448,
        "height": 144,
        "content": "## 📧 Email Trigger\nStarts the flow when a new email is received in Outlook.  \nThe “Get Message ID” node extracts the message ID, and  \n“Get Attachments” lists all files attached to that message.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "dccb657c-d4bc-4bf6-89fe-165e888b5a88",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1248,
        -256
      ],
      "parameters": {
        "color": 3,
        "width": 416,
        "height": 144,
        "content": "## 📊 Logging & Alerts\n- “Set Filename” prepares the Excel row.  \n- “Append to Excel Log” records the file name.  \n- “Notify User” (optional) sends a Teams message.\n"
      },
      "typeVersion": 1
    },
    {
      "parameters": {
        "operation": "verify",
        "email": "={{ $json.email || $json.Email }}",
        "additionalOptions": {}
      },
      "type": "n8n-nodes-billionverify.billionVerify",
      "typeVersion": 1,
      "position": [
        72,
        0
      ],
      "name": "Verify Email (BillionVerify)",
      "credentials": {
        "billionVerifyApi": {
          "id": "",
          "name": "BillionVerify account"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "is-deliverable",
              "leftValue": "={{ $json.is_deliverable }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ]
        }
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        252,
        0
      ],
      "name": "IF deliverable"
    },
    {
      "parameters": {
        "operation": "verify",
        "email": "={{ $json.email || $json.Email }}",
        "additionalOptions": {}
      },
      "type": "n8n-nodes-billionverify.billionVerify",
      "typeVersion": 1,
      "position": [
        760,
        16
      ],
      "name": "Verify Email (BillionVerify) 2",
      "credentials": {
        "billionVerifyApi": {
          "id": "",
          "name": "BillionVerify account"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "is-deliverable",
              "leftValue": "={{ $json.is_deliverable }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ]
        }
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        940,
        16
      ],
      "name": "IF deliverable 2"
    }
  ],
  "connections": {
    "Set Filename": {
      "main": [
        [
          {
            "node": "Append to Excel Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Folder ID": {
      "main": [
        [
          {
            "node": "Verify Email (BillionVerify) 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Message ID": {
      "main": [
        [
          {
            "node": "Verify Email (BillionVerify)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Attachments": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Notify User",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Folder ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On Mail Received": {
      "main": [
        [
          {
            "node": "Get Message ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to OneDrive": {
      "main": [
        [
          {
            "node": "Set Filename",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append to Excel Log": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Attachment": {
      "main": [
        [
          {
            "node": "Upload to OneDrive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verify Email (BillionVerify)": {
      "main": [
        [
          {
            "node": "IF deliverable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF deliverable": {
      "main": [
        [
          {
            "node": "Get Attachments",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Verify Email (BillionVerify) 2": {
      "main": [
        [
          {
            "node": "IF deliverable 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF deliverable 2": {
      "main": [
        [
          {
            "node": "Download Attachment",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "businessContext": {
      "data_flow": "Linear",
      "complexity": "Low",
      "department": "Finance/Accounting",
      "workflow_type": "Automation",
      "key_components": [
        "Email Processing"
      ],
      "integration_points": []
    }
  }
}