0

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.

1 Answer 1

1

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:

  1. Your application requests the user's authorization.
  2. The user logs in to his Google account and accepts.
  3. Your application creates a folder in his Google Drive instance.
  4. Your application retrieves the link of the newly created folder.
  5. 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
Sign up to request clarification or add additional context in comments.

16 Comments

Thanks for the response. I've been trying it, but am stuck on point 3, I can't find any documentation which shows me how to create a google drive folder from my flutter code I guess using the auth header or some other information from the Google sign in I made.
Hey @Kitcc, creating a folder using the Drive API is not trivial indeed. Sorry for not detailing that. To create a folder, you have to call the Drive.Files.insert endpoint setting the mimeType property to the following: application/vnd.google-apps.folder. Hope that helps, cheers!
Hey @Kitcc I suggest you visit this link. It's an example using dart to insert and download files in Google Drive. To create a folder, upon calling the function api.files.insert, you will have to provide a contentType parameter as follows: api.files.insert(driveFile, contentType: "application/vnd.google-apps.folder"). Cheers
Hey @carlesgg97 thanks so much for all the help. I've actually got no 3. working!
A question regarding number 4 above. From the response I get when the folder is created is it possible to get or derive the url share link to the folder, then I can just open it from my Flutter project.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.