Apr 26 2023 06:55 AM - edited Apr 26 2023 07:00 AM
Hi,
I have a document library where I want to mass change the "modified by" of the documents in it. I've tried the following on a single document:
$List = "My document library"
$ID = "2"
Set-PnPListItem -List $List -Identity $ID -Values @{"Editor"="email address removed for privacy reasons"}
The response looks ok (doesn't throw any errors):
Id Title GUID
-- ----- ----
2 xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
But, when I look at the document in the library, it has indeed changed, but it has the wrong user as Editor - It's the Powershell user that issued the command, rather than the user that I specified in Set-PnPListItem. What am I doing wrong?
(I wondered if I used the wrong field, but what I can see, "Editor" is the one to use)
EDIT: I also tried the field "Modified_x0020_By", but with the same result.
Apr 26 2023 07:21 AM
@JimGr Yes, Editor is the correct internal name of Modified by column in SharePoint.
Also, you have to use the -UpdateType parameter with the Set-PnPListItem cmdlet.
Check below links for more information about what value to use for this parameter:
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.
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs