I have seen many problems with people trying to update file names in their document library using flow without good results. After a few days of tweaking I have figured it out and am posting here to help others. I was able to accomplish this using an HTTP Call action and REST API. The built in action of update file properties or list item would not work as the only SP provided column / field that displays is 'Title'. I learned that there isn't a column called 'Name' (as shows up in the document library view), instead it is 'FileLeafRef'.
Solved! Go to Solution.
Thank you for your contribution to Microsoft Flow! This is a good method to update Filename in the SharePoint Document Library.
You could go ahead and mark your post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!
Community Support Team _ Lin Tu
@DawgPoundMBA1 Hi - I have been looking for help on this topic of changing the name of a file in sharepoint. I am not the most savvy on this level of a action, and so I am looking for some more insight on how this can work for my flow.
In your example, how can I provide the new name of the file based off of a Response data from a submitted Form?
Any help would be wonderful.
Can you provide more details on what you are doing as there are many different possibilities here? Are you talking about Microsoft Forms or about a SharePoint item view/edit form that opens when clicking on a list item? Is the file in a document library or is it an attachement to a list item? Where does the file name come from originally? How does the file get into SharePoint? Please give me more information on the overall process.
Sure thing, this is the overall flow I have going at this moment:
1. When a response is submitted from MS Form
2. Get Response details
3. Add a row into an Excel table - add columns value from the answer to Template Excel file (Document library in Sharepoint).
4. Copy file - copy the Excel file to the destination folder (different Document library in Sharepoint)
5. Update file - update file name according to the answers from the form. This is where is fails
6. List a row of a table - get all rows of template Excel file.
7. Delete a row - delete all rows of template Excel file for the Next answer.
I am able to get the file copied to the destination, but I am not able to change the name of the file in Sharepoint. I have tired multiple options, but none have worked so far.
Now THAT is obcure! Thank you @MattWeston365! Soooo glad you posted this!
I follow this but get stuck when it come to the replace(...), the 3 periods need some explanation (for me) of what to put here to replace ExistingName with NewName
I spent a lot of time trying to get it working for me. I needed to use uri functions, as I had "%20" for space in my file link. I was getting the file link from excel(inserted by forms file upload). I am sharing it in case someone finds in useful
I created a Set Variable and called it Filename_str and the Value included responses from my Microsoft form. You can use any dynamic content you have to fill in the requirements of your file name.
These responses then become the variable, and when the file was created I used the variable to create the file name. Just remember to use the .xlsx (if it is an excel) at the end so it saves correctly. I provided a screen shot of this part.