Forum Discussion

ChandanT's avatar
ChandanT
New member | Level 2
3 years ago

Search Folder or File with SearchV2Async

Hi,

 

I am trying to search for a specific folder in Dropbox using `Files.SearchV2Async` function in Dropbox sdk.

The search option is set to look for only the active files/folders, but with this option set `Files.SearchV2Async` returns even the deleted folder (the result for the deleted folder has IsDeleted flag as false, while I expected this to be true).

Am I missing anything here?

 

SearchOptions options = new SearchOptions(path,
    fileStatus: status.AsActive,
    filenameOnly: searchFiles);

var res = await _client.Files.SearchV2Async(query, options);

var matchesToConsider = res.Matches?.Where(x => !x.Metadata.AsMetadata.Value.IsDeleted);

 

1 Reply

  • kylea's avatar
    kylea
    Icon for Dropbox Staff rankDropbox Staff
    3 years ago

    To confirm, you're observing (1) that the search endpoint is returning a deleted folder when you specify active content only, and (2) that the returned search result also reporting that it is not deleted?

     

    I'm not able to reproduce that behavior. A couple questions:

    • How are you sure that the deleted folder is actually deleted? Is it possible you have similarly named folders?  I would look to compare the result of files/get_metadata with the search result's metadata to ensure we have the same path / id / status.
    • Is it possible that you deleted the folder at almost the same time as the search?
    • Are you able to reproduce this outside of the SDK (like in our API explorer) or is it specific to the SDK?  If the later, which version are you on?

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!