简体   繁体   中英

DropNet returning metadata for root folder not folder requested

Problem: GetMetaData for the folder that I need returns the root folder metadata.

Background: I'm trying to write a small app to download a folder that is too large (many thousand files and multiple GB) to download from the Dropbox web interface. It tries to recurse through the subdirectories of the directory given, downloading all the files.

What actually happens is an endless loop. The app (incorrectly) gets the root folder metadata, iterates through the directories until it hits the directory I need and then starts working through the root directory as that is the metadata set that it receives.

The directory name "/Apps" works fine but the one I need doesn't. The folder name has an underscore and a mix of upper and lower case letters (no other characters) similar to "/XYX_DataFolder".

My app has "Full Dropbox" permission and I authorized with the account that the api key was acquired under.

Changing the directory name is not an option for me.

I'm using VS2012 and the DropNet was added through NuGet.

Any input on this issue would be welcome. Thanks!

Edit:

Runtime Version v4.0.30319 Version 1.10.23.0

As reported in the Visual Studio properties page for the reference.

I authorize which works fine and then use the code below. Some directories work fine but when I try to GetMetaData on the folder mentioned above, I get the metadata from the root folder.

private void DownloadDirectory( string serverDirectory, string clientDirectory ) {
  var meta = m_client.GetMetaData( serverDirectory, false, false );
  foreach ( var item in meta.Contents ) {
    var destinationPath = Path.Combine( clientDirectory, item.Name );
    if ( item.Is_Dir && item.Path == m_serverRootDirectory ) {
      DownloadDirectory( item.Path, destinationPath );
    }
    else {
      //var fileBytes = m_client.GetFile( item.Path );
      //File.WriteAllBytes( destinationPath, fileBytes );
      //textBox1.Text += Environment.NewLine + destinationPath;
    }
  }
}

Ok, so I downloaded the source and found my problem right away. I was missing a null for the hash in the GetMetaData call, so it was using the wrong overload. Sorry to waste your time... Thanks for the response!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM