Hi,
I have the following code in a static helper class which works perfectly in a Windows UWP app:
public static DropboxClient dbxClient { get; private set; }
......
public static async Task<string> DownloadFile(string filePath, string fileName, string accessToken)
{
string output = null;
try
{
if (dbxClient == null)
dbxClient = new DropboxClient(accessToken);
if (dbxClient != null)
{
var downloadResponse = await dbxClient.Files.DownloadAsync(filePath + fileName);
var content = await downloadResponse.GetContentAsStringAsync();
DebugInfo += $"{filePath} downloaded - revision {downloadResponse.Response.Rev}";
output = content;
}
else
throw new Exception("DownloadFile: DropBox client not authenticated");
}
catch (Exception ex)
{
Exception = ex;
output = ex.Message;
}
return output;
}
Now I want to convert the app I created in UWP to Android so I copied it into my new Xamarin.Forms app and replaced the usual Dropbox.API NuGet package with Xamarin.DropBox.Api, but when I run the code I get this message:
Error in call to API function "files/download": Bad HTTP "Content-Type"
header: "application/x-www-form-urlencoded". Expecting one of "text/plain", "text/plain; charset=utf-8", "application/octet-stream",
"application/octet-stream; charset=utf-8".
I have googled this and searched on this forum but (so far) can't find anything relevant - can someone please let me know what I'm doing wrong? DropBoxClient seems to want a content-type (which is fair enough) but there does not seem to have any way to actually specify that from what I can see in the DropBoxClient properties and methods available.
Thanks in advance for any help offered.