Flutter URL to create and open a new google drive folder - google-chrome

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

Related

Opening a file on Google Drive directly in a Google Drive App

If I open the shareable link I have got for a file from Google Drive in the browser, I always get either to the Drive's internal preview program or to a download page (See below).
I would like to know whether there is a programmatic way to launch a specific drive-connected application (with confirmed access permissions) to open a file for which I have the link (and thus, the ID as well).
I don't want to do this through the drive's interface, but rather within my program. Let's say I want to let the users browse their files and open them in the browser with their default app as they have defined it on their drive (and let's say I already know that app).
To make it clear, I just want to achieve what Google Drive's interface does in the browser: You click a file, and it opens in a new tab in your default app.
In my opinion, this is possible with the use of Advanced Drive Service and Drive Service.
Advanced Drive Service
The advanced Drive service allows you to use the Google Drive web API in Apps Script. Much like Apps Script's built-in Drive service, this API allows scripts to create, find, and modify files and folders in Google Drive. In most cases, the built-in service is easier to use, but this advanced service provides a few extra features, including access to custom file properties as well as revisions for files and folders.
and for the Drive Service, you can use getUrl() method to get the URL that can be used to open the File in a Google App like Drive or Docs.
This service allows scripts to create, find, and modify files and folders in Google Drive.
Detailed information and sample codes regarding these services can be found in the documentations.

Can you create a Google Doc through an app and allow "Open With" through Google Drive and not just your app?

I am using the Google Drive Realtime API. I can successfully create the doc and have it show up in a user's Drive list. But when they open it, they only hit the Open URL, which routes them to my application. But can I allow them to open the doc with Google Docs instead of coming back to my app?
Its not a google doc, its your own custom format. Google drive wont know how to preview it thus it opens it with your app.

Possible to use Google scripts to integrate into Google Drive UI

Is it possible to use Google apps scripts deployed as a web app to integrate into the Google Drive UI?
i.e. opening files similar to: https://developers.google.com/drive/about-sdk#create_and_open_files_directly_from_the_drive_ui
But using Google scripts: https://developers.google.com/apps-script/
Scripts do have access to a drive api, but I'm unsure if they have the capability to integrate into the Drive UI?
Yes. You can create a script, deploy it as a web app and call it from the Drive UI as shown in the link you provide. Your script is passed parameter from the Drive UI (including for example, the folder currently selected) and you work from there... I use this mechanism to work with a folder structure representing client activity. Selecting a client folder, I can choose to open with my script or the usual Drive options. My script checks the parameters passed by drive and responds with an appropriate user interface for the next step.

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.

What does Google Picker API drivepreopen do?

I've noticed that some google drive apps fire POST request to https://docs.google.com/picker/drivepreopen?hostId=myhost upon file selection in picker dialog. Does anybody know what it does?
I need to be able to access my google docs files from my google drive app and I'm aware of the fact that drive apps can access only files it created or opened via context menu in google drive. As the name "drivepreopen" suggests maybe it allows you to programmatically invoke "open with"?
The Picker is how your app should be given access to a file and it can be used to display a list of the currently authenticated user's Drive files, as explained at https://developers.google.com/drive/integrate-open#open_files_using_the_google_picker.