Use CSOM to get files with no checked in version

Highlighted
Microsoft

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
Highlighted
IMHO, You can try Document Library Templates for migration which will do this job easily.
Highlighted
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
Highlighted

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

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

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 :)

Highlighted
I don't work for Metalogix and I was not thinking on Metalogix ;)
Highlighted
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?
Highlighted

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.

Highlighted

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,

Michal