[英]Programmatically share a dropbox link in .net without having user login to Dropbox
I have to programmatically share a dropbox link. 我必须以编程方式共享一个保管箱链接。
I upload programmatically files to my dropbox folder and need to get the url string of the shared link of my uploaded file. 我以编程方式将文件上传到我的保管箱文件夹,并且需要获取我上传的文件的共享链接的url字符串。
the process should be- uploading a file to dropbox, get a shared link for this document and then I will do something with this link. 该过程应该是-将文件上传到保管箱, 获取此文档的共享链接 ,然后我将对此链接执行某些操作。
I read a lot of topics online and on Stackoverflow, but all I found was with redirecting the user to the dropbox login page, this doesn't fit my case because my users don't have a dropbox account. 我在线上和在Stackoverflow上阅读了很多主题,但是我发现的全部是将用户重定向到保管箱登录页面,这不适合我的情况,因为我的用户没有保管箱帐户。
i did write my code using the dropnet library. 我确实使用dropnet库编写了代码。
any help will be very much appreciate. 任何帮助将不胜感激。
this is my code: 这是我的代码:
Public Sub ConnectToDropbox()
'1''''
Dim _client As New DropNetClient("11111111111111", "222222222222222222")
Dim login As Models.UserLogin = _client.GetToken()
_client.UserLogin = login
_client.UseSandbox = True
'2
_client.GetTokenAsync(AddressOf GetToken_success, AddressOf share_failed)
'3
Dim url = _client.BuildAuthorizeUrl()
Response.Redirect(url)
'4
_client.GetAccessTokenAsync(AddressOf GetAccessToken, AddressOf share_failed)
'5
_client.GetShareAsync("/AttachToEmail/flowers.txt", AddressOf share_success, AddressOf share_failed)
End Sub
but can't get it to work... 但无法正常运作...
You can use the DropNet
library. 您可以使用DropNet
库。 It comes with a way to log into dropbox, and upload a file, and you can write your code in C# .NET. 它带有一种登录到保管箱并上传文件的方法,您可以在C#.NET中编写代码。
Uploading the file after you are logged in works like that: 登录后上传文件的操作如下:
var uploaded = _client.UploadFile("/", "test.txt", content);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.