google-drive-api - 如何使用 Google Drive API 搜索自定义文件属性?

标签 google-drive-api

Google Drive 允许您将自定义属性添加到文件 ( https://developers.google.com/drive/v3/web/properties ),但它们不包含在可搜索文本中。

来自 https://developers.google.com/drive/v3/web/search-parameters :

fullText string contains Full text of the file including name, description, content, and indexable text.



您只能搜索完全匹配的属性:

appProperties has { key='additionalID' and value='8e8aceg2af2ge72e78' }



还有其他方法可以搜索自定义属性吗?

示例:如果我有一个带有自定义属性“标签”和值“事件银行紧急”的文件,我如何获得 files.list ( https://developers.google.com/drive/v3/reference/files/list ) 在我搜索“紧急”时找到这个文件?

最佳答案

论文方法呢?不幸的是,它找不到 appProperties 的灵活搜索。使用 q .因此,为了实现您想要做的事情,我提出了以下 2 种模式。

模式一

  • 使用 files/appProperties 检索具有 appProperties 的文件列表作为查询参数。
  • GET https://www.googleapis.com/drive/v3/files?fields=files%2FappProperties
  • 只有 appProperties从 Google Drive 上的所有文件中检索。
  • 通过脚本检索您需要的关键“标签”和值“事件银行紧急”。
  • 使用 appProperties has { key='tags' and value='active banking urgent' } 检索文件为 q .

  • 在此模式中,API 的使用计数为 2。

    模式2
  • 使用 files(appProperties,id,name) 检索具有 appProperties 的文件列表作为查询参数。
  • GET https://www.googleapis.com/drive/v3/files?fields=files(appProperties%2Cid%2Cname)
  • appProperties , fileIdfilename从 Google Drive 上的所有文件中检索。这些参数被搜索为 or .
  • 通过脚本,检索具有 appProperties 属性的元素,并使用您需要的 appProperties(键“标签”,值“事件银行紧急”)检索文件。

  • 在此模式中,API 的使用计数为 1。

    如果这对你没有用,我很抱歉。

    关于google-drive-api - 如何使用 Google Drive API 搜索自定义文件属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48555368/

    相关文章:

    java - Google Drive SDK 验证错误

    ruby-on-rails - Google API Ruby 客户端(gem)错误 `uninitialized constant Google::APIClient::UploadIO`

    ios - 在 Xcode 6.1 中使用 Google API Objective-C 客户端导入 Google Drive SDK 时出错

    php - Google API 权限不足列出文件

    google-drive-api - Google 云端硬盘权限 "add but not edit"

    google-drive-api - 合作实验室: Can I access to my Google drive folder and file?

    google-apps-script - 驱动器 PDF 修订 ID 被忽略

    java - Google 云端硬盘服务帐户返回 403 usageLimits

    python - 上传大文件不起作用 - Google Drive Python API

    javascript - Node.js Google云端硬盘客户端-下载文件: response. data.on时出错,此功能不起作用