1

I am developing a C# application which should connect to the user`s Dropbox using the DropNet C# Api. I connect my application like this:

UserLogin login=client.GetToken();
client.UserLogin = login;

String url = client.BuildAuthorizeUrl();

ConnectForm authorizer = new ConnectForm(url);
authorizer.ShowDialog(this);

try
{
    UserLogin accessToken = client.GetAccessToken();

    this.toolStripStatusLabel1.Text = "connected";
}

catch (DropboxException exc)
{
    client = new DropNetClient("API KEY", "API SECRET");

    this.toolStripStatusLabel1.Text = "error";
}

My toolStripStatusLabel displays "connected" after this code part and after I try to upload a file (or to create a folder) like this

client.UploadFile("/", "test.txt", File.ReadAllBytes("C:/Users/Me/Desktop/test.txt"));

this.toolStripStatusLabel1.Text = "File uploaded";

it displays "File uploaded" but there are still no files in my Dropbox.. My Dropbox Api Error Log shows some 403 errors but without any further information.

Does anybody know whats wrong here?

Rico Ocepek
  • 767
  • 6
  • 20
  • Did you get a valid access token? (Did `client.GetAccessToken` actually work?) What's the response you're getting back on `UploadFile`? The content of that response might help a lot when debugging. – user94559 Oct 09 '14 at 15:53
  • All the elements of the returned MetaData-object are either null or 0 or false.. that doesn't help me at all. – Rico Ocepek Oct 09 '14 at 16:52
  • You were absolutely right, the returned access token is null. But why? – Rico Ocepek Oct 09 '14 at 17:03

1 Answers1

1

I've found the solution.

When you register your application for "App-Folder" permission only you have to set client.useSandbox=true; directly after initalizing.

Rico Ocepek
  • 767
  • 6
  • 20
  • "useSandbox" sounds like it's actually referring to the root you call the API with, which is determined by which permission you registered for: https://www.dropbox.com/developers/reference/devguide#app-permissions This is unrelated to whether or not your app is released: https://www.dropbox.com/developers/reference/devguide#production-approval – Greg Oct 09 '14 at 18:43