I am trying to use HighLabo for dropbox communications. But it is giving an error. Here is my code
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/");
}
I am getting value can not be null error on
ai = ocl.GetAuthorizeInfo();
line. Does anyone know this problem?
Also i tried using Nemiro and Dropnet libraries. In Nemiro i can use with winforms. But neither nemiro nor dropnet is hard for webforms. I have to fix this problem.
HigLabo.Net.AuthorizeInfoif it is a non-static class