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
, fileId
和 filename
从 Google Drive 上的所有文件中检索。这些参数被搜索为 or
. appProperties
属性的元素,并使用您需要的 appProperties(键“标签”,值“事件银行紧急”)检索文件。 在此模式中,API 的使用计数为 1。
如果这对你没有用,我很抱歉。
关于google-drive-api - 如何使用 Google Drive API 搜索自定义文件属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48555368/