Good day,
A bit new with Power Automate... I am trying to build a flow that will automatically add attachments to a sharepoint list item.
It is a shared business OneDrive. So what we are trying to do :
If a file or multiple files in .pdf format is/are added to a specific folder in the shared OneDrive (they also show up in sharepoint document library), attach them to the sharepoint item if the files contain the item title name in the file name.
so if files are named 123-asd.pdf and zzz-asd.pdf, then add it to the sharepoint list item that has the title asd
Sometimes those are files are modified, so the sharepoint list item must have the latest version of the files.
My current flow and I am unable to get it to work :
1. When a file is created (properties only)
- I choose the site address
- I select the Documents library containing the file
2. Get file content
- Again, selecting the same site address
- File Identifier : Identifier from When a file is created (properties only)
3. Condition
endsWith(triggerOutputs()?['body/{FilenameWithExtension}'], '.pdf') is equal to True
True -> Get items
- From there I selected the site address and the list name
False -> Currently none
4. Condition (Under Get items)
contains(triggerOutputs()?['body/{FilenameWithExtension}'], item()?['Title']) is greater than 0
True -> Update item
- I select the Site address and the list name. For ID I select ID from For each and the title from For each.
Add attachment
- I select the correct site address and list name. ID from For each.
- File name : triggerOutputs()?['body/{FilenameWithExtension}']
- File Contant : Body from Get file content
Obviously, I did not add anything to update the file if it is modified, but the currently flow that I have is not working. In fact, it added the same attachment to all the list items, even if it did not contain the list item in the file name.
How can I fix my flow and get it to work correctly?
Thank you!