我开始开发一个项目来创建一些 dll 与 Dropbox(桌面)通信。
在谷歌搜索了一段时间后,我找到了 dropnet 并开始使用它。
这个库在访问令牌和上传时有两个问题。
代码:
Dim client As DropNetClient
If Not dropboxLoggedIn Then
client = New DropNetClient("XXXXXXXXXXXX", "YYYYYYYYYY")
client.UseSandbox = True
Dim token As UserLogin
Dim url As String = ""
Try
token = client.GetToken()
url = client.BuildAuthorizeUrl()
Dim aw As New AuthorizationWindow(url)
aw.ShowDialog()
If (Not dropboxLoggedIn) Then
client.GetAccessToken()
dropboxAsecret = client.UserLogin.Secret
dropboxAtoken = client.UserLogin.Token
Else
client.UserLogin.Token = dropboxAtoken
client.UserLogin.Secret = dropboxAsecret
End If
dropboxLoggedIn = True
Dim rawData As Byte() = File.ReadAllBytes("c:\users\mysuser\Pictures\anypic.JPG")
Dim result As MetaData = client.UploadFile("/", "anypic.JPG", rawData)
Catch ex As DropNet.Exceptions.DropboxException
MessageBox.Show(ex.Message)
End Try
Else
Try
client = New DropNetClient("XXXXXXXXXXXX", "YYYYYYYYYY", dropboxAtoken, dropboxAsecret)
client.UseSandbox = True
Dim rawData As Byte() = File.ReadAllBytes("c:\users\mysuser\Pictures\anypic.JPG")
Dim result As MetaData = client.UploadFile("/", "anypic.JPG", rawData)
Catch ex As DropNet.Exceptions.DropboxException
MessageBox.Show(ex.Message)
End Try
End If
所以,在我上传后,没有任何东西进入保管箱文件夹。结果没有任何属性。很奇怪,因为没有给出错误。此外,GetAccessToken 并不总是有效。
有人可以帮忙吗?