Forum Discussion

  • I just ran a test and this pulled back checked out items in a library in SharePoint Online:

     

    /_api/web/lists/getbytitle('Documents')/items?$filter=CheckoutUserId ne null

      • Drew Madelung's avatar
        Drew Madelung
        MVP

        I just ran this against a document library with files checked out from 2 different people and it returned both items:

         

        /_api/web/lists/getbytitle('Documents')/items?$select=CheckoutUserId/Title&$filter=CheckoutUserId ne null

         

        Screenshot of results:

         

  • Are you sure that the files have been checked in before. It may be that you cannot see files that are checked out because the files have never been checked in. Once the initial check in has happened, it becomes visible to all users, even if it's subsequently checked out.

    • Sebastián Acevedo Flórez's avatar
      Sebastián Acevedo Flórez
      Copper Contributor

      Yes, because he will see the last checked in version. But I need to see the first checked out file. The ManageCheckedOutFiles.aspx page allows me to see all check out files (including first checked out files)

  • Hello,
    Is there a reason you need to do this with the rest api? I was curious as I know this sort of task can be handled with a SharePoint view in the library by showing the "checked out to" column. The only other catch to this is the new files that were uploaded and not checked in for the first time that can be caught in the Library Settings > Managed files with no checked in version page.
    • Drew Madelung's avatar
      Drew Madelung
      MVP

      You are right files with no checked in version that were not uploaded by you are not visible via REST (as far as I can find via testing). What is your use case to find these files?  You could probably write a script to get this using CSOM.

  • SecretAsianMan's avatar
    SecretAsianMan
    Copper Contributor

    Sebastián Acevedo Flórez have you gotten an answer to this? I am looking for solution to this as well. Need to see all checked out files (to include initial upload checked out by another user/no checked in version). Thank you.

  • Late to the party, but hope it can help someone. If you want to look up files with no previous check in versions (which are displayed in the ManageCheckedOutFiles.aspx page), you can use REST API and GetCheckedOutFiles().

    https://contoso.sharepoint.com/sites/sitename/_api/web/lists/GetByTitle('ListTitle')/GetCheckedOutFiles()
    It works at least in SharePoint Online. It will return only files with no check in versions, but not regular checked out files.

Resources