use*_*165 1 c# dropbox dropbox-api
我正在使用 Dropbox.Net API v2.0 将文档上传到 Dropbox:
private async Task Upload(DropboxClient dbx, string localPath, string remotePath)
{
using (var fileStream = File.Open(localPath, FileMode.Open))
{
var s = await dbx.Files.UploadAsync(remotePath, body: fileStream);
}
}
Run Code Online (Sandbox Code Playgroud)
如何获取已上传文档的共享链接?
我已经尝试过:
await dbx.Sharing.GetSharedLinkFileAsync(remotePath);
Run Code Online (Sandbox Code Playgroud)
但出现以下错误:
<Message>An error has occurred.</Message>
<ExceptionMessage>shared_link_not_found/.</ExceptionMessage>
Run Code Online (Sandbox Code Playgroud)
我正在想一些东西,但不确定是什么,有什么想法吗?
我找到了答案:
var result = await dbx.Sharing.CreateSharedLinkWithSettingsAsync(remotePath);
var url = result.Url;
Run Code Online (Sandbox Code Playgroud)
效果非常好。
| 归档时间: |
|
| 查看次数: |
4150 次 |
| 最近记录: |