Skip to main content

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.

 

27163i65F43BDE7375A008.png

 

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

Hi,





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.





Finally:
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.


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.

TIA


Reply