SharePoint REST API Setting CheckoutUser using ValidateUpdateListItem()

Tony 11 Reputation points
2022-05-02T23:44:49.883+00:00

I am trying to update the CheckoutUser for a file in SharePoint because when the file is checked out in my code, it is being checked out by a SharePoint admin account and I want the CheckoutUser to show the person who actually checked it out. Whenever I make a request to _api/web/GetList(@path)/items(id)/ValidateUpdateListItem()?@path='/url' with the user info, I get a 200 response back and no errors, but for some reason the CheckoutUser value is cleared instead up updating to be the user that I want to set. This is what the request body looks like:

{
    "formValues": [
        {
            "FieldName": "CheckoutUser",
            "FieldValue": "[{'Key': 'i:0#.w|user.name'}]"
        }
    ],
    "bNewDocumentUpdate": true
}

I have tested out requests to both SharePoint 2016 and SharePoint Online using Postman and have not been able to get the CheckoutUser to update in either case.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,270 questions
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,807 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Tong Zhang_MSFT 9,141 Reputation points
    2022-05-03T07:05:01.657+00:00

    Hi @Tony ,

    Thanks for the detailed description of the case. When I received the case, I searched a lot of documents did a lot of researches.

    I use the REST API _api/web/lists('list-id')/items(id)/ValidateUpdateListItem() to do test ,but I get the error: The file \"https://xxxxx.sharepoint.com/sites/xxxx/test1/Document1.docx\" is checked out for editing by i:0#.f|membership|xxx@xxxxx. (the screenshot of my test results is as follows) .

    We will continue to research this issue ,If there is an update or progress, will tell you in time. Thank you for your understanding and support.

    198399-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.


    1 person found this answer helpful.