Is there a REST API to modify/update readonly properties such as 'Created by' and 'Modified Date' in SharePoint online

Abdul Saif Babu 61 Reputation points
2021-03-01T13:59:16.67+00:00

We are trying to figure out a way to update the system read-only properties such as 'Created by' and 'Modified Date' in SharePoint. We are using REST API to work with data in SP and hence if there is a REST API to achieve this, it would be great.

We are aware of a workaround to create custom attributes and copy and hide the original columns, but we are looking to understand if there is a REST API way to accomplish this.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,560 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Jerryzy 10,561 Reputation points
    2021-03-02T05:49:48.977+00:00

    Hi @AbdulSaifBadu-7422,

    Rest API ValidateUpdateListItem endpoint can be used to update system field (Created/Created By, Modified/Modified By), please see the sample request in PostMan:

    Request Url and Header:

    73209-snipaste-2021-03-02-12-21-11.png

    Request Body:

    73210-snipaste-2021-03-02-12-21-44.png

    {  
       "formValues":[  
          {  
             "FieldName":"Author",  
             "FieldValue":"[{'Key':'i:0#.f|membership|user@Tenant.onmicrosoft.com'}]"  
          },  
          {  
             "FieldName":"Created",  
             "FieldValue":"17/1/2021"  
          },  
          {  
             "FieldName":"Editor",  
             "FieldValue":"[{'Key':'i:0#.f|membership|user@Tenant.onmicrosoft.com'}]"  
          },  
          {  
             "FieldName":"Modified",  
             "FieldValue":"17/1/2021"  
          }  
      
       ]  
    }  
    

    This is the update result with the request above:

    73239-snipaste-2021-03-02-12-09-43.png

    Here is a blog with the same solution, I suggest you can refer:

    How to update created by and modified by field in sharepoint List using REST API

    Update: per the deep test, the Rest option above is not working for modern site library, so it's more suggested to use PowerShell(CSOM/PnP PowerShell) to update SharePoint system field, this option is working for both classic/modern library:

    SharePoint Online: Update Created By / Modified By, Created / Modified Field Values using PowerShell

    Thanks
    Best Regards


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

  2. T.Romanski 1 Reputation point
    2022-04-27T10:04:29.117+00:00

    Unfortunately this method does not work for the author field in document library

    0 comments No comments