如何使用Google Drive API搜索自定义文件属性?
Google云端硬盘可让您向文件添加自定义属性( https://developers. google.com/drive/v3/web/properties ),但它们不包含在可搜索文本中.
Google Drive allows you to add custom properties to files (https://developers.google.com/drive/v3/web/properties), but they aren't included in the searchable text.
来自 https://developers.google.com/drive/v3/网络/搜索参数:
fullText string contains Full text of the file including name, description, content, and indexable text.
您只能搜索完全匹配的属性:
You can only search for exact property matches:
appProperties具有{key ='additionalID'和value ='8e8aceg2af2ge72e78'}
appProperties has { key='additionalID' and value='8e8aceg2af2ge72e78' }
还有其他搜索自定义属性的方法吗?
Is there some other way to search the custom properties?
示例:如果我有一个带有自定义属性标签"且值为紧急活动银行"的文件,该如何获取files.list
(
Example: if I have a file with custom property "tags" and value "active banking urgent", how can I get files.list
(https://developers.google.com/drive/v3/reference/files/list) to find this file when I search for "urgent"?
这些方法怎么样?不幸的是,它无法使用q
灵活地搜索appProperties
.因此,为了实现您想要的目标,我提出了以下两种模式.
How about theses methods? Unfortunately, it couldn't find the flexible search for appProperties
using q
. So in order to achieve what you want to do, I propose the following 2 patterns.
- 使用
files/appProperties
作为查询参数检索具有appProperty的文件的列表.-
GET https://www.googleapis.com/drive/v3/files?fields=files%2FappProperties
- 仅从Google云端硬盘中的所有文件中检索
appProperties
.
-
- Retrieve a list of files which have appProperties using
files/appProperties
as a query parameter.GET https://www.googleapis.com/drive/v3/files?fields=files%2FappProperties
- Only
appProperties
from all files on Google Drive is retrieved.
在这种模式下,API的使用计数为2.
In this pattern, the usage count of APIs are 2.
- 使用
files(appProperties,id,name)
作为查询参数检索具有appProperty的文件的列表.-
GET https://www.googleapis.com/drive/v3/files?fields=files(appProperties%2Cid%2Cname)
从Google云端硬盘上的所有文件中检索 -
appProperties
,fileId
和filename
.这些参数以or
搜索.
-
- Retrieve a list of files which have appProperties using
files(appProperties,id,name)
as a query parameter.GET https://www.googleapis.com/drive/v3/files?fields=files(appProperties%2Cid%2Cname)
-
appProperties
,fileId
andfilename
from all files on Google Drive are retrieved. These parameters are searched asor
.
在此模式下,API的使用计数为1.
In this pattern, the usage count of APIs are 1.
如果这对您没有用,很抱歉.
If this was not useful for you, I'm sorry.