Skip to content

Enable shared drive support (supportsAllDrives & includeItemsFromAllDrives) #25

@akhoury

Description

@akhoury

Without this option, the Google Drive API will return 404 File not found if you're trying to access a Shared Drive from a different domain, EVEN IF THEY add your service account email to the shared list of people/members or as a member of the drive.

https://developers.google.com/drive/api/guides/enable-shareddrives

I think basically adding supportsAllDrives and includeItemsFromAllDrives to the Options and plumbing them through should be enough, I tried to get this done in a fork, but i can't get typescript to work correctly, I think it's making wayyy more changes to them than needed, i will just share the 3 changes that I made in case someone else needs them or can get them merged properly

Added to the IOptions interface
https://github.com/drschoice/sync-gdrive/blob/44489638917c9deabb92e208bbcacabe91527b3a/src/interfaces/IOptions.ts#L12-L13

Added to the drive.files.list call in visitDirectory
https://github.com/drschoice/sync-gdrive/blob/44489638917c9deabb92e208bbcacabe91527b3a/src/index.ts#L270-L271

Added to the drive.files.get call in fetchContents
https://github.com/drschoice/sync-gdrive/blob/44489638917c9deabb92e208bbcacabe91527b3a/src/index.ts#L318

Usage

syncGDrive(SHARED_DRIVE_FOLDER_ID, destinationFolder, keyConfig, { 
    supportsAllDrives: true,
    includeItemsFromAllDrives: true,
    verbose: true,
    abortOnError: true,
    callback: (err, result) => {
        // console.log(err, result)
    }
});

Thank you

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions