我正在嘗試使用HighLabo進行Dropbox通信。但它給出了一個錯誤。這是我對Asp.Net文件通過API上傳到Dropbox?
ai = ocl.GetAuthorizeInfo();
行代碼
private const string App_key = "my_app_key";
private const string App_secret = "my_app_secret";
OAuthClient ocl = null;
HigLabo.Net.AuthorizeInfo ai = null;
public void UploadFile(byte[] content, string filename, string target)
{
ocl = DropboxClient.CreateOAuthClient(App_key, App_secret);
ai = ocl.GetAuthorizeInfo();
string RequestToken = ai.RequestToken;
string RequestTokenSecret = ai.RequestTokenSecret;
string redirect_url = ai.AuthorizeUrl;
AccessTokenInfo t = ocl.GetAccessToken(RequestToken, RequestTokenSecret);
string Token = t.Token;
string TokenSecret = t.TokenSecret;
DropboxClient cl = new DropboxClient(App_key, App_secret, Token, TokenSecret);
HigLabo.Net.Dropbox.UploadFileCommand ul = new HigLabo.Net.Dropbox.UploadFileCommand();
ul.Root = RootFolder.Sandbox;
ul.FolderPath = target;
ul.FileName = filename;
ul.LoadFileData(content);
Metadata md = cl.UploadFile(ul);
}
protected void Button1_Click(object sender, EventArgs e)
{
//string filename = Path.GetFullPath(FileUpload1.FileBytes);
//byte[] bytes = System.IO.File.ReadAllBytes(filename);
UploadFile(FileUpload1.FileBytes, "sundas.jpg", "/Apps/synch/");
}
我越來越 值不能爲空的錯誤。有誰知道這個問題?
另外我嘗試使用Nemiro和Dropnet庫。在Nemiro我可以使用winforms。但nemiro和dropnet都不適合webforms。我必須解決這個問題。
嘗試實例'HigLabo.Net.AuthorizeInfo'如果它是一個非靜態 – Oluwafemi
類@Oluwafemi我在哪裏可以使用HigLabo.Net.AuthorizeInfo。我無法使用HigLabo.Net.AuthorizeInfo。它不是一個DLL或命名空間。 –