简体   繁体   English

DropNet返回根文件夹的元数据,未请求文件夹

[英]DropNet returning metadata for root folder not folder requested

Problem: GetMetaData for the folder that I need returns the root folder metadata. 问题:我需要的文件夹的GetMetaData返回根文件夹元数据。

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. 背景:我正在尝试编写一个小型应用程序以下载太大的文件夹(数千个文件和多个GB),无法从Dropbox Web界面下载。 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. 目录名称“ / Apps”可以正常工作,但我不需要。 The folder name has an underscore and a mix of upper and lower case letters (no other characters) similar to "/XYX_DataFolder". 文件夹名称带有下划线,并且混合使用大小写字母(无其他字符),类似于“ / XYX_DataFolder”。

My app has "Full Dropbox" permission and I authorized with the account that the api key was acquired under. 我的应用程序具有“ Full Dropbox”权限,并且我使用了获取api密钥的帐户进行了授权。

Changing the directory name is not an option for me. 更改目录名称不是我的选择。

I'm using VS2012 and the DropNet was added through NuGet. 我正在使用VS2012,并且通过NuGet添加了DropNet。

Any input on this issue would be welcome. 欢迎就此问题提供任何意见。 Thanks! 谢谢!

Edit: 编辑:

Runtime Version v4.0.30319 Version 1.10.23.0 运行时版本v4.0.30319版本1.10.23.0

As reported in the Visual Studio properties page for the reference. 如在Visual Studio属性页中所报告以供参考。

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. 某些目录工作正常,但是当我尝试在上述文件夹上获取GetMetaData时,我从根文件夹获取元数据。

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. 我在GetMetaData调用中缺少哈希的null,因此它使用了错误的重载。 Sorry to waste your time... Thanks for the response! 抱歉浪费您的时间...感谢您的回复!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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