这类似于我之前的问题: 从 Dropbox 上的公共共享文件夹下载图像
我有这段代码(简化版),需要从公共共享文件夹和所有子文件夹下载所有图像。
using Dropbox.Api;
using Dropbox.Api.Files;
...
// AccessToken - get it from app console
// FolderToDownload - https://www.dropbox.com/sh/{unicorn_string}?dl=0
using (var dbx = new DropboxClient(_dropboxSettings.AccessToken))
{
var sharedLink = new SharedLink(_dropboxSettings.FolderToDownload);
var sharedFiles = await dbx.Files.ListFolderAsync(path: "", sharedLink: sharedLink);
// var sharedFiles = await dbx.Files.ListFolderAsync(path: "", sharedLink: sharedLink, recursive: true);
// "recursive: true" throws: Error in call to API function "files/list_folder": Recursive list folder is not supported for shared link.
foreach (var entry in sharedFiles.Entries)
{
if …Run Code Online (Sandbox Code Playgroud) 必须在 Dropbox 上上传大文件。我也想实现上传进度条。到处都提到我应该使用 UploadSessionStartAsync。我不知道如何使用 UploadSessionStartAsync 覆盖现有文件(当它已经存在时)。我可以先删除文件,然后进行新的上传,效果很好,但我不能这样做,因为之前文件的文件元数据丢失了。使用 UploadAsync 很容易,因为已经有一个 WriteMode.Overwrite 参数!这是我的代码:
/// <summary>
/// Uploads a big file in chunk. The is very helpful for uploading large file in slow network condition
/// and also enable capability to track upload progerss.
/// </summary>
/// <param name="client">The Dropbox client.</param>
/// <param name="folder">The folder to upload the file.</param>
/// <param name="fileName">The name of the file.</param>
/// <returns></returns>
private async Task ChunkUpload(DropboxClient client, string folder, string fileName)
{
Console.WriteLine("Chunk upload file...");
// Chunk size …Run Code Online (Sandbox Code Playgroud)