Hello,
One of the Projects I am working on, I have a requirement to rename the SharePoint Document Library file name upon upload. Basically I have a lookup column called 'Entity ID' from which the user selects a value before hitting on Save or CheckIn as its a mandatory field. This will be the case for every file upload in this specific library location.
Let's say the Uploaded file name was: "Test Accounting" and the chosen Entity ID value was "15001". So once the user hit on save or checkin buttons the document in the library, then the renamed file name would look like: "Test Accounting 15001". Bascially the selected Entity ID value must be appended to the end of the File name as renaming convention while uploading or post upload.
Is this possible to do using Flow? Please help if anyone knows, thanks in advance.
Solved! Go to Solution.
Hi @Anonymous,
Could you please share a bit more about your SharePoint library?
Do you want your flow to rename your uploaded file after you selected a value within Entity ID field and clicked the Save button?
I have made a test on my side and please take a try with the following workaround:
@not(empty(triggerBody()?['Entity_x0020_ID']))
concat(split(triggerBody()?['{FilenameWithExtension}'],'.')[0],' ',triggerBody()?['Entity_x0020_ID']['Value'],'.',split(triggerBody()?['{FilenameWithExtension}'],'.')[1])
File Content field set to File Content dynamic content of the "Get file content" action.
Then add a "Delete file" action, specify Site Address and the File Identifier field set to Identifier dynamic content of the trigger.
Add a "Copy file" action, specify Site Address, Source File Path set to Path dynamic content of the trigger, Destination File Path field set to Folder path dynamic content of the trigger and the DisplayName dynamic content of the "Create file" action.
Add a "Delete file 2" action, specify Site Address and the File Identifier field set to Id dynamic content of the "Create file" action.
Image reference:
Note: The Entity ID column is a Lookup type column in my SharePoint library.
The flow works successfully as below:
Best regards,
Kris
Hi @Anonymous,
Could you please share a bit more about your SharePoint library?
Do you want your flow to rename your uploaded file after you selected a value within Entity ID field and clicked the Save button?
I have made a test on my side and please take a try with the following workaround:
@not(empty(triggerBody()?['Entity_x0020_ID']))
concat(split(triggerBody()?['{FilenameWithExtension}'],'.')[0],' ',triggerBody()?['Entity_x0020_ID']['Value'],'.',split(triggerBody()?['{FilenameWithExtension}'],'.')[1])
File Content field set to File Content dynamic content of the "Get file content" action.
Then add a "Delete file" action, specify Site Address and the File Identifier field set to Identifier dynamic content of the trigger.
Add a "Copy file" action, specify Site Address, Source File Path set to Path dynamic content of the trigger, Destination File Path field set to Folder path dynamic content of the trigger and the DisplayName dynamic content of the "Create file" action.
Add a "Delete file 2" action, specify Site Address and the File Identifier field set to Id dynamic content of the "Create file" action.
Image reference:
Note: The Entity ID column is a Lookup type column in my SharePoint library.
The flow works successfully as below:
Best regards,
Kris
hi @v-xida-msft
i want to try this, could you help out by explaining it more detail in step by step?
i mean, where do i start and how?
thanks.
pytbyt