Google Drive API v3 getting root folder Id in java

后端 未结 2 1783
傲寒
傲寒 2021-01-06 16:53

I tried several things bu couldn\'t get the root folder id in Java Api v3.

What I tried:

String id = service.files().get(\"fileId=root\").setFields(\         


        
相关标签:
2条回答
  • 2021-01-06 17:13

    Try the following combination to see if that works.

    String id = service.files().get("root").setFields("id").execute().getId();
    
    0 讨论(0)
  • 2021-01-06 17:13

    To execute the above combination, you have to give your application full access to use Drive. OAuth 2.0 scope that needs to be given: https://www.googleapis.com/auth/drive or https://www.googleapis.com/auth/drive.readonly

    0 讨论(0)
提交回复
热议问题