Use CSOM to get files with no checked in version


I have a PowerShell script that uses SPDocumentLibrary.CheckedOutFiles to get files that are checked out in a library. This property is a list of checked out files including files that have no checked in version.

I'm writing a script to run against a SPO tenant and I'm looking for the same functionality using CSOM.

I have confirmed that List.GetItems and List.RootFolder.Files does not return the files I'm looking for...


We are migrating data between SPO tenants and we need these documents checked in before migrating.

9 Replies
IMHO, You can try Document Library Templates for migration which will do this job easily.
How many document libraries do you need to migrate? I assume you know how to "grab" the check out files and force the Chec-in using the UI

Thousands of libraries, millions of documents. There is no acceptable manual process. It must be automated.

If that's your case, why you don't use a migration tool?

We're using Metalogix but checked out documents are not migrated (the last checked in version is migrated). That can't be changed so let's not go down the Metalogix rabbit hole for this discussion :)

I don't work for Metalogix and I was not thinking on Metalogix ;)
I have tested List.RootFolder.Files and it returns checked out files as well as files without version numbers as expected.
You have mentioned that List.RootFolder.Files does not return the files you are looking for. Can you let me know what files it returned?

List.RootFolder.Files only returns files that have been checked in at least once. I see all of the files except the files that have never been checked in.

Hi Kerry,

I have the same issue.

I need to get a full list of files that are checked out, including never checked in and to send it to the library owner.

did you managed to get a solution? 

Thanks in advance,