Thank you for contacting Microsoft Community.
To create a Power Automate flow that automatically copies PDF files from a OneDrive folder to the corresponding Document Set in a SharePoint library based on filename and metadata column match, I try to test, and you can try my below step by step solution:
- Trigger Setup
- Use the trigger “When a file is created” in OneDrive for Business.
- Apply a filter to ensure only
.pdffiles are processed.
- Extract Filename
- Use the “Get file metadata” action to retrieve the filename.
- Apply an expression to remove the
.pdfextension: split(triggerOutputs()?['headers']['x-ms-file-name'],'.')[0]
- Retrieve Document Sets
- Use the “Get files (properties only)” action from SharePoint to retrieve all Document Sets and their metadata.
- Use “Filter array” to find the Document Set where the designated column matches the extracted filename.
- Copy File
- Use the “Create file” action in SharePoint to copy the PDF into the matched Document Set folder.
- Use dynamic content to retain the original filename.
- Error Handling
- Add a “Condition” to check if a match was found.
- If no match is found, log the filename or send a notification.
Note and some reference I have found may be helpful for you:
- Power Automate supports workflows across OneDrive and SharePoint, including copying files between them and automating tasks based on metadata conditions. You can start by selecting a flow template or creating a custom flow from scratch using the Power Automate designer interface Microsoft Support Reference
- For more information on copying files between OneDrive and SharePoint, please refer to this guide: Copy files and folders between OneDrive and SharePoint
Please understand that as a community moderator, because of our limit of scope and our response does not always resolve the issue immediately. However, with your help and more detailed information, we can work together to find a solution.
I really hope my information helpful for you! Feel free to ask me if you have any trouble!
Best Regards,
Vicky-I - MSFT | Microsoft Community Support Specialist