Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

mansi2821's avatar
mansi2821
Explorer | Level 4
4 years ago

ListFolderContinueAsync recursive not showing correct result

-using dropbox.net SDK

-CodeSnippet

 

ListFolderResult listFolderResult;

listFolderResult = dropboxClient.Files.ListFolderAsync(controlpath,true, false, false, false, true, 200).Result;


var listfoldercontinuearg = new ListFolderContinueArg(cursor);
var listFolderResult = dropboxClient.Files.ListFolderContinueAsync(listfoldercontinuearg).Result;


using ablove code snippet, able to fetch chenges made on the home location (ie.:\\home).
but not able to fetch changes which are made on subfolder(ie.:\\home\subfolder)

4 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    4 years ago

    Make sure you're retrieving and processing all of the pages from ListFolderAsync and ListFolderContinueAsync. You're not guaranteed to get everything back by just calling each one once. You need to keep calling ListFolderContinueAsync with the latest cursor until ListFolderResult.hasMore is false to be sure you've retrieved all of the entries. Refer to the ListFolderAsync documentation for more information.

     

    If you're already doing so, please share the rest of the relevant code for reproducing this issue.

  • mansi2821's avatar
    mansi2821
    Explorer | Level 4
    4 years ago

    hello Thanks For your response here is my code 

     

    ListFolderResult listFolderResult;

    listFolderResult = dropboxClient.Files.ListFolderAsync(controlpath,true, false, false, false, true, 200).Result;

    do
    {

    var listfoldercontinuearg = new ListFolderContinueArg(previousDeltaLink);

    listFolderResult = dropboxClient.Files.ListFolderContinueAsync(listfoldercontinuearg).Result;

    foreach (var entry in listFolderResult.Entries){}


    if (listFolderResult.HasMore)
    {
    previousDeltaLink = listFolderResult.Cursor;

    }

    } while (previousDeltaLink.IsNotNullOrEmpty());

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    4 years ago

    Can you clarify where/how the initial value of previousDeltaLink is being set though? In this code, it only seems to be set after each ListFolderContinueAsync call. I don't see where you're setting it from the initial call.

     

    It looks like you are correctly setting the recursive parameter to true on the ListFolderAsync call, but you need to make sure you use that resulting cursor. Also, make sure you read out the entries from each page, including ListFolderAsync. I don't see you doing so in this code; you're only reading out the entries from ListFolderContinueAsync in this code.

  • mansi2821's avatar
    mansi2821
    Explorer | Level 4
    4 years ago

     

    hey my issue is solved 

     

    Thanks for your response

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!