Forum Discussion
kentss
Apr 03, 2020Copper Contributor
Script to rename a file in a document library to match the values in the document library columns
I'm stuck. I have a document library where files are uploaded with random names. Is it possible to write a script to rename the file when it comes into the document library to match the values in the document library columns? Like "filename-author-time created.pdf" The Sharepoint is on-premise.
any help would be great
4 Replies
- RobElliottSilver Contributor
kentss this could also be done with a flow in Power Automate starting with the SharePoint When a file is created (properties only) trigger.
Rob
Los Gallardos
Microsoft Power Automate Community Super User - Another option is to create an Azure Logic App that triggers on file created.
I have a client using this approach and works fine - Yep, totally possible...you can use CSOM (Client Side Object Model) in PowerShell or PnP cmdlets to do that
- kentssCopper Contributor
Thanks for the positive answer, but would it be possible to maybe point me in a general direction as to how it is actually done with Powershell? Anything would help.
Thanks,
Kentss