Accessing Binary data from Multiple Items

Describe the problem/error/question

I am building a Workflow, which does some OCR on Invoices and Files them to OneDrive following a specific naming schema. I am downloading Attachments from Exchange, doing the OCR and finally filing those to OneDrive. If I have more than 1 Mail, or more than 1 Attachment within a Mail, I process multiple items.

I was not able to access the binary Data from a previous Item, it always returned the first Binary data. Meaning if I have 2 Items, all 2 Items return the Binary data of the first Item.
This is how accessed the binary data:

image

As a workaround, I use now the messageId and attachmentId throughout my workflow and redownload the attachment before uploading to OneDrive. That way, it works. Main difference, as downloading again directly before uploading, is, I can access the binary data using

image

I was wondering, if it should actually work to access binary data of a previous node (in my example “Upload a file” node using the “download attachments”)?

thank you, stefan

What is the error message (if any)?

None, just accessing always the first binary data of the array of items.

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: latest
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Linux

Hi @schnuderl, welcome!

Use this expression but place it in a Set node before your “Upload a file” node, and make sure the type is set to “Binary data”:

After that, reference the binary using the same field name that you defined in the Set node..