Skip to content

Instantly share code, notes, and snippets.

@thomashagstrom
Created January 11, 2019 13:13
Show Gist options
  • Save thomashagstrom/f398d1b9a68993263818c539c0467b85 to your computer and use it in GitHub Desktop.
Save thomashagstrom/f398d1b9a68993263818c539c0467b85 to your computer and use it in GitHub Desktop.
DropboxClient
using (var client = new DropboxClient(this.AccessToken))
{
// List files
var list = await client.Files.ListFolderAsync(string.Empty);
IList<Metadata> entries = list?.Entries;
// Get file as bytes
var response = await client.Files.DownloadAsync(file);
var bytes = response?.GetContentAsByteArrayAsync();
// Write file
var commitInfo = new CommitInfo(filename, WriteMode.Overwrite.Instance, false, DateTime.Now);
var metadata = await client.Files.UploadAsync(commitInfo, new MemoryStream(fileContent));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment