Tag: dropbox api

使用Restsharp PCL上传到Dropbox

我正在尝试使用RestSharp.Portable使用PCL将文件上传到Dropbox。 我的代码是 public async Task UploadFile(Stream fileStream, string fileName) { var client = new RestClient(“https://api-content.dropbox.com”); client.ClearEncodings(); client.AddEncoding(“gzip”, new GzipEncoding()); var request = new RestRequest(“1/files/dropbox/Apps/FileBolt”, HttpMethod.Post); request.AddHeader(“Authorization”, string.Format(“Bearer {0}”, Token)); request.AddParameter(“file”, fileName); byte[] bytes = null; long numBytes = fileStream.Length; using (var br = new BinaryReader(fileStream)) { bytes = br.ReadBytes((int) numBytes); } request.AddFile(new FileParameter { ContentLength […]

使用asp.net mvc在Dropbox中下载文件

我正在使用asp.net mvc 4和dropbox-api从我的Dropbox帐户下载文件。 我已成功在我的项目中安装了api,我正在按照本教程了解function,但如果我运行,我会收到错误, 指定的参数超出了有效值的范围。 参数名称:路径 这是我的代码, public async Task DropDls() { var dbx = new DropboxClient(“MY-TOKEN”); string folder = “My Folder”; string file = “My File.rar”; using (var response = await dbx.Files.DownloadAsync(folder + “/” + file)) { await response.GetContentAsStringAsync(); } return View(); } 我是api与api相关的作品,所以无法弄清楚这里有什么问题。 但我需要这样做。 如果我得到专家的帮助,我将不胜感激。 谢谢。

文件上传Dropbox v2.0 API

我正在使用新的Dropbox SDK v2 for .NET。 我正在尝试将文档上传到Dropbox帐户。 public async Task UploadDoc() { using (var dbx = new DropboxClient(“XXXXXXXXXX”)) { var full = await dbx.Users.GetCurrentAccountAsync(); await Upload(dbx, @”/MyApp/test”, “test.txt”,”Testing!”); } } async Task Upload(DropboxClient dbx, string folder, string file, string content) { using (var mem = new MemoryStream(Encoding.UTF8.GetBytes(content))) { var updated = await dbx.Files.UploadAsync( folder + “/” […]