So, I'm new to using an external API for projects, but I got an idea and would like to know if I can upload files to Dropbox correctly. I went through the steps to get the key and token, and I started testing, but I ran into an error:
An unhandled exception of type "System.ArgumentNullException" occurred in DropNet.dll Additional information: The value cannot be null.
Update: In the future, in case of an error, the actual parameter equal to null will be "userLogin" **
This is my code before the error: // using Dropnet;
DropNetClient _client = new DropNetClient("API_KEY", "API_SECRET", DropNetClient.AuthenticationMethod.OAuth1);
Error code:
var url = _client.BuildAuthorizeUrl();
And my code following the error:
Process.Start(url);
_client.GetAccessTokenAsync((accessToken) =>
{
_client = new DropNetClient("API_KEY", "API_SECRET", accessToken.Token, accessToken.Secret);
},
(error) =>
{
MessageBox.Show(error.Message);
});
try
{
_client.UploadFile("/", "test.txt", ReadFile(@"D:\Classes\Documents\test.txt"));
MessageBox.Show("Successfully uploaded to Dropbox.", "Uploaded to Dropbox");
}
catch (Exception dropboxEx)
{
MessageBox.Show("Error: " + dropboxEx.Message);
}
, - , , ? OAuth uri , , , , , Dropbox:
, , , !