Search code examples
google-drive-api

sharedWithMe does not work with drive.file scope


I am working on a .NET Google Drive app with scope drive.file. My app does not show up the list of shared files through the query Q = sharedWithMe. However, when I change my app's scope to drive the list of files appears. Why does it not work when the scope is set to drive.file? I created another project on Drive console and tested it but again it failed.


Solution

  • The Drive.Files scope states it only gives access to files opened or created by the app. The new API is more restrictive of file scope, I believe because Google is trying to push dev's to use the new google file picker (as a security measure), to get access to files not created by the app.

    Your solutions are:

    1. use the Google file picker.
    2. use the previous api, and use a broader scope.
    3. share explicity with app (@pinoyyid answer), e.g. by creating an application owned account.

    Update: I just tested, and can confirm your results. "Created by application" is not an attribute shared between accounts. It only affects the original account.