cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Blarue
Frequent Visitor

Add attachment when new list item is created using flow

Hi,

I would like to be able to auto attach an excel workbook or worksheet to a SharePoint list time when it is created. I have tried the "get file content" approach but it only attaches a blank document and i have to download it to open 

 

2 REPLIES 2
DAllen365
Resolver II
Resolver II

@Blarue I did a quick POC for this and got it working, I don't know what is tripping you up but I am guessing its the file identifier in the get file content.  I added a trigger condition to only run on files that contain xlsx in their filename.  Here's my flow:

 

  • Trigger - when file is created (properties only)
  • Get file content (with Identifier property)
  • Get item (I just manually chose an ID manually, but this would need to be more dynamic based on your requirements)
  • Add attachment - use filenamewithextension from trigger, and file content from get file content and ID from the get item

Save xls as attachment.png

The trigger condition is this expression:

@contains(triggerBody()?['{FilenameWithExtension}'],'.xlsx')

 

In my test, it fired the flow for XLS, and didn't start when I uploaded a PDF.  That is much better than adding a condition to check the filename after having the Flow start.  Here is the attachment and it works if I just click it from the item:

 

xls attachment.png

 

Hope that addresses your problem!


----------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Blarue
Frequent Visitor

Thank you for your reply, but will this work if the trigger is when a SharePoint list Item is created? I am trying see if there is a way to automatically attach an excel file from another SharePoint document library as an attachment to each new SharePoint list item when they are created. 

 

could you break down the steps for me for something like this:

1. Trigger : When a SharePoint list item is created

2. Get file content (from a SharePoint document library) 

3. Add attachment 

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Users online (43,370)