Java – Google DRIVE API V3 – Get a folder id with name

google-drive-apijava

I could find only ways to get the root folder id from google drive api -[REFERENCE]: Google Drive API v3 getting root folder Id in java . I have to get the folder id by giving a name. Is there anyway i could get Folder id of a directory in Drive by passing its name.

Best Answer

You can search for a specific folder with these parameters:

name = 'your-folder-name'
mimeType = 'application/vnd.google-apps.folder'

The mime type makes sure, that you are only searching for folders. For more information, take a look at the documentation of the search parameters here.