Google Drive API not shows all files from Google Drive - google-drive-api

I am creating an application which can insert files into Google Drive and lists it. I am using Google Drive API. But my problem is that for some accounts it is not listing all files in my application. but for many account it shows all files perfectly
so i am no clear that what is the issue is it permission issue or another?
if in google drive folder i have set share setting with public then only it shows all folder
I have used below scope
I have used below scope........ var googlePlusOptions = new GoogleOAuth2AuthenticationOptions
{
ClientId = "",
ClientSecret = ""
};googlePlusOptions.Scope.Add("openid");
googlePlusOptions.Scope.Add("profile");
googlePlusOptions.Scope.Add("email");
googlePlusOptions.Scope.Add(DriveService.Scope.Drive);
googlePlusOptions.Scope.Add(DriveService.Scope.DriveAppdata);
googlePlusOptions.Scope.Add(DriveService.Scope.DriveAppsReadonly);
googlePlusOptions.Scope.Add(DriveService.Scope.DriveFile); googlePlusOptions.Scope.Add(DriveService.Scope.DriveMetadataReadonly);
googlePlusOptions.Scope.Add(DriveService.Scope.DriveReadonly);
googlePlusOptions.Scope.Add(DriveService.Scope.DriveScripts);
googlePlusOptions.Scope.Add(DriveService.Scope.DrivePhotosReadonly);

I searched the other SO ticket that is related to your problem, I found that the issue is in the setting of the scope. Make sure the scope that you use is https://www.googleapis.com/auth/drive.
You can also check this documentation for more information about the SCOPE.
This are the related SO question.
Google Drive SDK API does not lists the file uploaded by Google Drive in java
Access to all files on a user's Google Drive

Related

Flutter URL to create and open a new google drive folder

I'm wondering is there a URL I can run that will create a new Google Drive folder and then open it in the Google Drive app (on phone or tablet).
I know you can create the folder via the google drive API, but not open the Google Drive app it seems.
I'm looking for something like the Google Maps URL where you specify e.g. destination coordinates in the URL and it opens with the route to those coordinates.
Many thanks for any help with this.
I'm afraid that creating a folder that way is not possible. You can however, do it through the API. The flow would be as follows:
Your application requests the user's authorization.
The user logs in to his Google account and accepts.
Your application creates a folder in his Google Drive instance.
Your application retrieves the link of the newly created folder.
Your application opens the URL. In case the user has the "Google Drive" application, and he has not set Google Drive links to open with another app by default, it will be open with the app.
You can read more about how to create a Drive Folder using the Google Drive API for Dart here:
Dart GoogleAPIs Package: Library to use several Google APIs.
Files create endpoint: Endpoint to call to create a folder. To create it, you will have to set the "mimeType" in the request body to: application/vnd.google-apps.folder

How does listing files/folders inside of google drive work?

I have been reading the reference and also used the API explorer, but I cannot for the life of me manage to get a full list of what's inside a specific folder of my google drive.
As far as I understand, the following code should list all files inside the folder that has the given folderID. That does work; but only on files that I created from my app. Folders/files created with or uploaded through the web UI will not show up in the response.
const folders = await drive.files.list({
q: "'<folderID>' in parents",
trashed: false,
spaces: ['drive']
});
In a different post I found that the scope might be the issue, but as far as I know I have already given my app the highest available scope:
const SCOPES = ['https://www.googleapis.com/auth/drive'];
I appreciate any help on this matter. :)
Your symptoms are consistent with using drive.file scope instead of drive. Is it possible that you granted access using drive.file and haven't yet repeated the grant procedure with drive?
The other possible explanation is that you are in two different Drive Accounts. Many people use a Service Account because the Google docs refer to this as server-to-server, without realising that the Service Account is a totally different account to their User Account, ie. the one with the Drive UI. So your app will be uploading and reading files in the Service Account, your UI-created files are in your User Account.

Google Api Drive Creating File with Different Domains

I had a domain www.xxx.com and have changed to www.xxx.co.
I've already added this new domain on console.developers.google and authorize Google Works "third parts" to access drive.
But every time I create a file through the google API drive with my app it creates on my root count that i logged in and not on the folders of my antique domain.
Is it a problem of permission right? How can I solve this?

Google drive api: copy error with scopes "drive.file" and "drive.readonly"

My question is if it is not possible to copy a file from one folder in drive to another folder in drive with the google drive api if you only have the scopes "drive.file" and "drive.readonly"?
Tested using the API explorer: https://developers.google.com/drive/v2/reference/files/copy
The error is: "The authenticated user has not granted the app X write access to the file Y".
Creating a file (using the same scopes) and copying it is possible however.
Figured I ask and put the answer up since it's hard to find info about the google drive api.
It is possible but you also need the "drive.metadata" scope for it to work. You can ofc use the "drive" scope but that provides more access than needed.

Granting APP authorization to Google Drive files

I am trying to authorize files on my google drive with specific APP authorization I created. As files on my google drive can only be manipulated by its authorized app, is there any way I can convert these "None" authorized file with APP authorization? And, if yes, by which function?
I looked all over the tutorial document but only find discussion about permission. The only method I can think about is uploading these files to google drive with upload function from my created app. But I guess there is a much smarter way. Do any one has the same experience?
Here list my steps to create authorized file:
First, I start my app from using sample code, DrEdit. https://developers.google.com/drive/examples/python;
From the code, I successfully open new files and saw them listed on my google drive.
From view authorized app, I can clear see these apps created from my app have their authorization signed with app ID. The other files original belong to me have these authorization signed as "None".
I had the same issue and had to change the scope from https://www.googleapis.com/auth/drive.file to https://www.googleapis.com/auth/drive which gives full access to all drive files rather than just the ones created by the app.