Forum Discussion

Kerry_Williams's avatar
Oct 05, 2016

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

  • SanthoshB1's avatar
    SanthoshB1
    Bronze Contributor
    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?
    • Kerry_Williams's avatar
      Kerry_Williams
      Icon for Microsoft rankMicrosoft

      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.

      • Michal Golan's avatar
        Michal Golan
        Copper Contributor

        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

  • SanthoshB1's avatar
    SanthoshB1
    Bronze Contributor
    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
      • Kerry_Williams's avatar
        Kerry_Williams
        Icon for Microsoft rankMicrosoft

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

Resources