
Announcements
Hello, is it possible when a new item is created on a sharepoint list, it will check the document library for the pdf file with a unique file name that is same with the item on title column on the sharepoint list and get the pdf file to upload it to the attachment column of the sharepoint list? Thanks!
Here is the sample flow.
1. Add trigger "When an item is added" and set the site URL & list name. In this example, I have taken 'SampleList' as custom list:
2. Next, add "Get files (properties only)" action to lookup the file in document library based on the title column field. We could achieve this by using filter query. Here I am looking for a pdf file in default Documents library:
Filter query:
FileLeafRef eq '@{triggerOutputs()?['body/Title']}.pdf'
If title contains file extension (.pdf) then you need to remove it in the above filter query. You could copy it & paste this query directly in your flow.
3. Add "Apply to each" action, pass the value object from get file properties as its input. Inside it, add 'Get file content' to get the file content from SharePoint library:
Finally, add "Add attachment" action to attach the file to the list item:
If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.
Thanks