Attach a SharePoint Online List Item Attachment(s) to NWC Workflow Assign a Task or Send an Email

  • 18 November 2022
  • 3 replies

Badge +3

I have a workflow with Start event: SharePoint - New List Item. The SharePoint online list item will have files attached to it. In the workflow, I am trying to "Assign a task" to a particular person which sends an email that includes the file attached to the item (if there is one). In my testing, I have found that the task email is not received but the I can see the task is created from NWC dashboard.


I proceeded to try another scenario of attaching the file using "Send an email." In this case, I received the following error message:


Unable to process the email attachment. File attachment variable must be a File or a Collection of files. [Error Code: IO.GenericActionExecute.ErrorResponse]


In both cases, I am using the Item Attachments variable from the Start event.




Any ideas? I've submitted a ticket to support but waiting on them to get back to me.


Best answer by Prineel_V3 18 November 2022, 18:07

View original

3 replies

Userlevel 2
Badge +8


You need to get the attachments names, then add the attachments to a collection variable:
Step 1:
Use the "Get attachment names" action, configure it and output an object

Step 2:
In your loop for each, add the attachment collection from your object:

Step 3:
Use a "Get item attachment by name" action and configure it. In the attachment name config, use the current item from your loop for each tab (this will get each attachment by its name and we will store it in a collection). The output is a type file SharePoint Online Variable (we will use this in the next step)

Step 4:
Use an "Add item to collection" action to add the attachment into the collection based on the index from the loop for each. You will need to create a Workflow collection variable to store the files (In this example, i called it Attachments Collection which is in the target collection config and output config):

The value is the output (the actual attachment) from the previous step.

We can then use the collection variable that we created which will contain the attachments in both email and task actions:

Hope this helps 🙂

Let me know if I need to clarify anything.

Badge +3

Thank you so much! This works.


Thank you for this post.

How can I add the attachments to a PDF?  I have used the documentation for the list item data and I now want to add the attachments so they are visible in the the final PDF.  I am using the document generation action.