I need to find a way using Powershell to set the value of a field in a document library based on a folder name. So for example if there is a folder called "00170" and there is a field named "Reference", I would like the value of "00170" set to this field.

I have little to none scripting skills so would appreciate some help with this.


1 Answer 1


No need to use PowerShell.

Do you want to set the field in this folder to the folder name? If so, you can go to library settings > Column default value settings, select your folder under "Location to configure" section. enter image description here
Then click the "reference" field and set a default value for this field. enter image description here If you want to grant the folder name to the reference column of this folder, you can create a workflow to achieve your purpose. Just using "Update list Item" action in the workflow to grant the folder name to the reference column of current item. enter image description here

  • Thank you imp. MSFT. I got it but what if you have hundreds of folders to do this Job? Please suggest. Thank you in advance.
    – Sha
    Jul 19, 2019 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.