Dustin
Dustin

Reputation: 744

Searching a specific folder isn't limited to that folder

I'm attempting to use children->listChildren with a folder id and a search parameter, the code looks like this

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

Where $export_dir is the id of a folder. In this case, if I have trashed the folder called 'Folder Title' my search will find it in the Trash folder, NOT the specified folder id. I was expecting that a trashed folder would not appear in the search results because I specified a different folder to search. Am I assuming incorrectly or should I be filing a bug report?

Upvotes: 2

Views: 334

Answers (1)

Alain
Alain

Reputation: 6034

When listing files, folder and/or parents, trashed files/folders will be part of the returned collection by default.

To prevent this behavior, use the q="trashed = false" query parameter to let the API knows that you are requesting untrashed files/folders. From your code snippet:

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

Upvotes: 1

Related Questions