如何从谷歌驱动器文件夹中获取信息?

时间:2018-10-18 16:54:34

标签: android kotlin google-drive-android-api google-drive-realtime-api flysystem-google-drive

我想在this one之类的共享文件夹中获取有关pdf文件的信息,其中包含两个pdf文件,我想获取每个文件的名称和链接(如果可能的话,还有第一页的图片)

我正在为此使用Kotlin。我不知道我必须使用什么,我听说了Google Drive Api,但是我认为我不需要登录或连接以获得这些信息,我发现这很有趣,但是我不知道如何使用它(这使我在files()上出现错误,这表示未知引用:

private fun printFile(service: Drive, fileId: String) {

    try {
        val file = service.files().get(fileId).execute()

        System.out.println("Title: " + file.getTitle())
        System.out.println("Description: " + file.getDescription())
        System.out.println("MIME type: " + file.getMimeType())
    } catch (e: IOException) {
        println("An error occurred: $e")
    }

}

0 个答案:

没有答案