Google drive api 搜索特定文件夹不是';我不局限于那个文件夹

Google drive api 搜索特定文件夹不是';我不局限于那个文件夹,google-drive-api,Google Drive Api,我试图使用带有文件夹id和搜索参数的children->listChildren,代码如下所示 $parameters['q'] = "title = 'Folder Title'"; $children = $dlist->children->listChildren($export_dir, $parameters); 其中$export_dir是文件夹的id。在这种情况下,如果我丢弃了名为“文件夹标题”的文件夹,我的搜索将在垃圾箱文件夹中找到它,而不是在指定的文件夹id中找到

我试图使用带有文件夹id和搜索参数的children->listChildren,代码如下所示

$parameters['q'] = "title = 'Folder Title'";
$children = $dlist->children->listChildren($export_dir, $parameters);

其中$export_dir是文件夹的id。在这种情况下,如果我丢弃了名为“文件夹标题”的文件夹,我的搜索将在垃圾箱文件夹中找到它,而不是在指定的文件夹id中找到它。我原以为丢弃的文件夹不会出现在搜索结果中,因为我指定了另一个要搜索的文件夹。我的假设是错误的还是应该提交错误报告?

在列出文件、文件夹和/或父项时,默认情况下,垃圾文件/文件夹将是返回的集合的一部分

要防止这种行为,请使用
q=“trashed=false”
query参数让API知道您正在请求未刷新的文件/文件夹。从您的代码片段:

$parameters['q'] = "title = 'Folder Title' AND trashed = false";
$children = $dlist->children->listChildren($export_dir, $parameters);

您是否可以检查垃圾“文件夹标题”的元数据,并确认
$export\u dir
不在文件夹的
父集合中?文件布局为/root/A共享目录/文件夹标题/任意文件夹/某些文件。我正在使用Mac上的Finder破坏名为folder Title的文件夹,因为这是Google Drive在那里构建的,所以共享的“A shared dir”是空的。我可以确认'Folder Title'的父ID是'A shared dir'的父ID,而不是垃圾桶dir,垃圾桶dir似乎没有ID。“explicitelyTrashed”标志设置为TRUE。但是,您可以将查询参数设置为
$parameters['q']=“Title='Folder Title'和trashed=false”
这应该会删除垃圾桶中的文件。我会试一试,谢谢