【问题标题】:Google Drive API Query by Name Returns InvalidGoogle Drive API 按名称查询返回无效
【发布时间】:2016-01-12 03:42:15
【问题描述】:
  1. 根据 Google Drive 文档,要按名称查询文件,您将使用:q="name = 'file name'"。

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

  2. 当我在这里尝试按名称搜索时:https://developers.google.com/drive/v2/reference/files/list#try-it

    将“q”字段设置为“name = 'file_name'”。

    “参数‘q’的值无效。”被退回。

  3. 当我尝试在 Python 中执行命令时会发生同样的情况:\ service.files().list(q="name = 'file_name'").execute()

  4. q="trashed=false" 等其他命令工作正常。不知道为什么“名称”查询没有。

【问题讨论】:

    标签: google-drive-api


    【解决方案1】:

    您遇到的问题是您尝试使用专门为Drive v3 API 定义的搜索参数和Drive v2 API

    当使用Drive v2 API时,文件名在'title'下,所以一个有效的查询是:

    title = 'TestDoc'

    而在Drive v3 API 中,文件的名称位于“名称”下:

    name = 'TestDoc'

    【讨论】:

    • 谢谢! ==> 标题 = 'TestDoc'
    猜你喜欢
    • 2023-03-28
    • 1970-01-01
    • 1970-01-01
    • 2016-05-03
    • 1970-01-01
    • 1970-01-01
    • 2013-08-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多