SOLVED

Using PowerShell to update document properties

Copper Contributor

Hello,

We have a Document library that has approvals turned on, we have people assigned as Approvers who have now left the company and I need to update multiple documents with a new Approver.

I have little experience with using PowerShell, I have found pnpOnline the most straightforward to follow so far.

I can get the field values.

(Get-PnPListItem -List "Documents" -Id 12 -Fields "Title","Modified").FieldValues

I don't know how to set field values for a specific document.

 

Can anyone tell me how I would update a specific document property for a file?

Or point me at an article that explains this, all the searching I have done hasn't turned up anything yet.

 

Cheers

Rosie

 

4 Replies
best response confirmed by Rosie Horn (Copper Contributor)
Solution

@Rosie Horn You can use Set-PnPListItem cmdlet for updating properties.

Check below documentation for more information (specially check "-Values" parameter): Set-PnPListItem 


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

@Rosie Horn Hi! This might be easy to solve (and maybe even without using PowerShell) but I need to know a little more about how your library is structured and designed first. How have you assigned the Approver role to these people? Have you used any workflow or just set a field that shows who is responsible for approving documents? If you can attach a picture it would be very helpful. Thanks in advance.

@MagnusGoksoyrOLDProfile 

I know how to do it in the library but it goes through the approval process. I could turn that off but I have found it then fires after I turn it back on. The modified date and modified by fields are also updated.

The approver is a column and the person is selected, the field is a person type.

Here is a screenshot.

ControlledDocumentsScreenshot.png

 

Thanks

Rosie

UPDATE POWERSHELL
1 best response

Accepted Solutions
best response confirmed by Rosie Horn (Copper Contributor)
Solution

@Rosie Horn You can use Set-PnPListItem cmdlet for updating properties.

Check below documentation for more information (specially check "-Values" parameter): Set-PnPListItem 


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

View solution in original post