cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AEdwards214
Regular Visitor

Need to Create a flow that has new SharePoint Library items trigger a Sharepoint list item with the file as the list item attachment

Hello,

 

I am looking to create a power automate flow which triggers whenever new pdf files are entered into a SharePoint library. When a new file is entered into this specific SharePoint library folder, it should create a SharePoint list item in a separate SharePoint site, with the pdf file as an attachment on the list item. 

 

Any assistance would be appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @AEdwards214,

 

Yes that would be possible with flow with a couple of SharePoint actions. I would also use a trigger condition to make sure the flow only starts when it is a pdf file.

 

Below is an example of such an approach.

 

1. I used a trigger condition in the settings of the When a file is created (properties only) trigger action.

@endsWith(triggerOutputs()?['body/{FilenameWithExtension}'], '.pdf')

 

triggercondition.png

 

2. After that I use a Get File Content by using the Identifier field from the first action.

 

3. With a Create Item I create a new list item

 

4. And lastly a Add Attachment is used to add the pdf file to the list item. This action uses the ID of step 3, the File Content of step 2 and the File name with extension field of step 1.

 

createlistitemwithattachment.png

View solution in original post

4 REPLIES 4
Expiscornovus
Super User
Super User

Hi @AEdwards214,

 

Yes that would be possible with flow with a couple of SharePoint actions. I would also use a trigger condition to make sure the flow only starts when it is a pdf file.

 

Below is an example of such an approach.

 

1. I used a trigger condition in the settings of the When a file is created (properties only) trigger action.

@endsWith(triggerOutputs()?['body/{FilenameWithExtension}'], '.pdf')

 

triggercondition.png

 

2. After that I use a Get File Content by using the Identifier field from the first action.

 

3. With a Create Item I create a new list item

 

4. And lastly a Add Attachment is used to add the pdf file to the list item. This action uses the ID of step 3, the File Content of step 2 and the File name with extension field of step 1.

 

createlistitemwithattachment.png

This is excellent, and the flow you demonstrated produces the list item I need with the attachment, but for some reason the attachment is not generated as a pdf. Is there another step that needs to happen to ensure the attachment is encoded as a PDF? I just wanted to make sure I didn't miss something.

Expiscornovus
Super User
Super User

Hi @AEdwards214,

 

No extra step should be needed. I have also tested the solution in my dev environment with a couple of pdf files before I shared the solution with you btw.

 

Just to double check? Did you use the 'File Name with Extension' dynamic content field in the File Name field of the Add Attachment action?

Typical user error. The specific pdf I had created to test it was bad. Every other one since works like a charm. I really appreciate your help with this!!!

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,339)