Forum Discussion

gbc04's avatar
gbc04
Explorer | Level 3
2 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?

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    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

      * 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

        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.