SharePoint Rest API modify "who modified by" and security classification using OAuth token postman

Nagavalli Puli 1 Reputation point
2022-05-25T07:03:45.017+00:00

I am working with SharePoint rest API calls, I have client ID and token using them I can generate OAuth token, using OAuth token I am able to upload files.

but when upload the file how can I update who last modified by and file security classification using SharePoint Rest API calls.

while file upload set modified by and security classification

file upload example :https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/upload-a-file-by-using-the-rest-api-and-jquery

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,686 questions
SharePoint Workflow
SharePoint Workflow
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Workflow: An orchestrated and repeatable pattern of business activity, enabling data transformation, service provision, and information retrieval.
513 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,576 questions
Microsoft Partner Center API
Microsoft Partner Center API
Microsoft Partner Center: A Microsoft website for partners that provides access to product support, a partner community, and other partner services.API: A software intermediary that allows two applications to interact with each other.
317 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Tong Zhang_MSFT 9,116 Reputation points
    2022-05-26T02:40:28.55+00:00

    Hi @Nagavalli Puli ,

    Based on my research and testing, there is no way to change the modified by and security classification at the same time as uploading the file. As a workaround, you can use the following REST API to change the modified by and security classification after uploading the file:

    _api/web/lists/getByTitle('listname')/items(itemid)/ValidateUpdateListItem  
    

    Body:

     {  
        "formValues":[  
           {  
              "FieldName":"Editor",  
              "FieldValue":"[{'Key':'i:0#.f|membership|xxx@xxxxx.onmicrosoft.com'}]"  
           }  
          
        ]  
     }  
    

    My test:

    Upload file: _api/web/GetFolderByServerRelativeUrl('/sites/xxxx/526')/Files/add(url='FullCode.txt',overwrite=true)
    205663-image.png

    Update Modified by: _api/web/lists/getByTitle('5.26')/items(8)/ValidateUpdateListItem
    205692-image.png

    Test result:
    205711-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    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.



  2. Nagavalli Puli 1 Reputation point
    2022-05-26T03:59:14.883+00:00

    Hi @Tong Zhang_MSFT Thank you for your support.

    I have a property security classification, its a dropdown with multiple values, how can i update that.


  3. Nagavalli Puli 1 Reputation point
    2022-05-26T08:03:51.717+00:00

    I am getting 400 bad request with API _api/web/lists/getByTitle('listname')/items(itemid)/ValidateUpdateListItem, can you suggest using relative path how can i modify.

    example using relative path i can read the file properties.


  4. Nagavalli Puli 1 Reputation point
    2022-06-23T15:17:56.043+00:00

    @Tong Zhang_MSFT I am not able to update using the relative path could you please help me with this.

    please see the error screenshot.

    214413-image.png

    0 comments No comments