Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable shared drive support (supportsAllDrives & includeItemsFromAllDrives) #25

Open
akhoury opened this issue Aug 6, 2023 · 3 comments

Comments

@akhoury
Copy link

akhoury commented Aug 6, 2023

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

@ajmas
Copy link
Owner

ajmas commented Aug 6, 2023

If you know the fix and are able to make a PR, then it will help this getting addressed sooner.

@ajmas
Copy link
Owner

ajmas commented Apr 16, 2024

I'll integrate the changes, but if you need help with Typescript please send me a message,

ajmas added a commit that referenced this issue Apr 16, 2024
ajmas added a commit that referenced this issue Apr 16, 2024
Issue #25 Added support for shared drives
@ajmas
Copy link
Owner

ajmas commented Apr 16, 2024

Have made the changes, but have not yet had a chance to fully test them. Will mark as 'partially-fixed' for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants