Search code examples
javagoogle-drive-apisynchronizationgdrive

How to find a gdrive file link


I have created a folder name "Invoices" in my laptop. And shared as public folder in gDrive. Now I create invoices using Java Application as save on that file. They are finely syncing with gDrive Invoices" Folder and all are in as public access mode. Every invoices is uploaded is in public access mode automatically. But how can I find the link of each file automatically or Any code using Java?


Solution

  • The best place to start would be with the Google apis java client library. This client library will make it easer for you to connect to the api and authorize your aplication.

    I recommend starting with the Java Quickstart it will show you how to create an application and connect to the google drive api.

    Just watch the dependencies last time i tried they were out of date make sure to grab the latest

    apply plugin: 'java'
    apply plugin: 'application'
    
    mainClassName = 'DriveQuickstart'
    sourceCompatibility = 11
    targetCompatibility = 11
    version = '1.0'
    
    repositories {
        mavenCentral()
    }
    
    dependencies {
        implementation 'com.google.api-client:google-api-client:1.33.0'
        implementation 'com.google.oauth-client:google-oauth-client-jetty:1.32.1'
        implementation 'com.google.apis:google-api-services-drive:v3-rev20211107-1.32.1'
    }
    

    If you have any issues getting it to work edit your question and include your code i would be happy to have a look i think i have an updated sample floating around. That i have not published to my own website yet.