Forum Discussion

JimGr's avatar
JimGr
Copper Contributor
Apr 26, 2023

PnP Powershell - Setting "modified by" on documents in library

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.

1 Reply

Resources