Created
January 11, 2019 13:13
-
-
Save thomashagstrom/f398d1b9a68993263818c539c0467b85 to your computer and use it in GitHub Desktop.
DropboxClient
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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