简体   繁体   中英

How to get google drive folders path

I have authenticated for google drive using passport js

Now I have access token

So I am looking for to get all folders path with their respective folder Id.

I am not aware what parameters need to set to get only folders path and folder id

I am using google-drive library for fetching lists

Here is my code

var googleDrive = require('google-drive')
 var param={}
 googleDrive(accessToken).files().list(params, (err, response, body) => {
                       //fetch folders path
                    })

Thanks.

Try changing

var param={}

to

var param={q: "mimeType='application/vnd.google-apps.folder' and trashed=false"}

With all due respect to the authors of the library you are using, be very careful. Either a library deal with all of Drive's subtleties (eg. following nextPageTokens) or it will cause you problems. The Drive REST API is a very well formed API, and you could just as easily access it using Fetch, which, being Promise based, makes for much cleaner code and allows you to use async await .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM