Forum Discussion

gbc04's avatar
gbc04
Explorer | Level 3
3 years ago

Folder searches using the API often fail.

I created a function to download data files at the desired time by searching folders by date in a program (C#) through App Key (OAuth 2) and used it for several years.
However, from 09-12 to the 12th, the folder list could not be viewed, but from 09-18, access was possible from the 12th to the 18th.
After that, it suddenly showed up on 10-04 from the 1st to the 4th, and has not worked again until now (10-05).
I can view it through the Dropbox program, but why can't I access it only through the API?
Is there any workaround for this?

4 Replies

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

    I'll be happy to help with any issues you're having with the Dropbox API, but I'll need some more information. Please reply with:

    • the name and version number of the platform and SDK/library you are using, if any
    • the steps to reproduce the issue, including relevant code snippet(s), but don't include any access or refresh token(s)
    • the full text of any error or unexpected output
  • gbc04's avatar
    gbc04
    Explorer | Level 3
    3 years ago

    * SDK information is [Official Dropbox .Net v2 SDK v5.0.7591]

     

    * Source Code

    using (var dbx = new DropboxClient(Program.ConfigIni.BaseInfo.DropBoxApiTokenKey))
    {
       string DownForderName = "/" + Program.ConfigIni.BaseInfo.ServerOpenPath;
       var aData = await dbx.Files.ListFolderAsync(DownForderName);

       //When loading here, only part of the folder information is displayed, but all is displayed in the dropbox program.
       var list = aData.Entries.OrderBy(x => x.Name).ToArray();

       //show folders then files
       foreach (var item in list.Where(i => i.IsFolder))
       {
          IsActivce = true;
          string FileFullPath = "";
          FileFullPath = item.Name;

          var ForderInFiles = await dbx.Files.ListFolderAsync(DownForderName + "/" + item.Name);
          foreach (var Files in ForderInFiles.Entries.Where(i => i.IsFile))
          {
              ~~~
          }
    }
    }

  • Здравко's avatar
    Здравко
    Legendary | Level 20
    3 years ago

    gbc04 wrote:

    ...
       var aData = await dbx.Files.ListFolderAsync(DownForderName);

       //When loading here, only part of the folder information is displayed, but all is displayed in the dropbox program.
       var list = aData.Entries.OrderBy(x => x.Name).ToArray();

    ...


    Hi gbc04,

    How many are all files/folders in the folder, that's object of listing/enumeration? Keep in mind that 'ListFolderAsync' only starts the listing (and possibly completes it when short enough). Its result is the first page from the result and eventually the only, but may be more pages! There is a flag that shows whether are more pages or just received page is the last - you never checked it in your code. When there are more pages, you have to continue pagination to the last one - something you skipped.

    Hope this gives direction.

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

    gbc04 Здравко is correct; you need to implement both ListFolderAsync and ListFolderContinueAsync. You aren't guaranteed to get all results back in just one call to ListFolderAsync. Please refer to the documentation linked there for information on how to use this.

About Discuss Dropbox Developer & API

Node avatar for Discuss Dropbox Developer & API
Make connections with 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!