2

Trying to figure out a way to use REST or JSOM to find all checkedout files in a library. I can use a list view to show which files are checked out and by whom, but there is no way to see how long ago it was checked out and I need this information. I need to do this from the client side/in-browser.

I found this thread about viewing the CheckedOutDate column, but the approved answer doesn't make sense to me and I assume it is something that you need central admin access.

$item = $web.lists[...].items[...]
$checkedOutDate= $item.File.CheckedOutDate.ToString()

I thought I might try REST and found this post which talks about this endpoint.

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

But that throws Column CheckoutUserId does not exist error. But when I remove the filter I can see the CheckoutUserId in the list of columns returned and when I check the Fields endpoint I do see the field and saw that it also has a different name CheckedOutUserId. And I am able to filter on that property.

After that I've got a list of checked out files, but I still can't get when it was checked out. I don't see that field anywhere. Does anyone know how to get that date?

1 Answer 1

5

Are you sending this as a GET? It should be.

This query worked for me: (same as your example)

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

The $select clause is for clarity, but using just the $filter clause alone works fine.

I don't think the CheckedOutDate property is accessible via REST for the library request.

5
  • Is there some other way to get the CheckedOutDate?
    – Rothrock
    Feb 8, 2019 at 20:32
  • Oh and CheckoutUserId throws an error that it doesn't exist.
    – Rothrock
    Feb 8, 2019 at 20:33
  • you need to $expand=CheckoutUserId and somehow work with CheckedOutDate too Feb 8, 2019 at 21:00
  • "CheckoutUserId throws an error that it doesn't exist" Just to confirm... you are using SharePoint 2013? Are you testing with a FullControl account? Feb 8, 2019 at 22:15
  • SP 2013 on prem. I'm a site collection admin and have full control. I see CheckoutUserId, but when I try to filter on it it throws an error. I don't see CheckedOutUserId, but can filter on that. But what I really need is the date!
    – Rothrock
    Feb 11, 2019 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.