We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
setycz
2 years agoExplorer | Level 3
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: E
Dear support, since 20th May we have started to encounter random failures when invoking `DropboxClient.Files.ListFolderAsync` function, see the following stacktrace: Newtonsoft.Json.JsonR...
DB-Des
Dropbox Engineer
Could you provide the actual code that you are running?
Please include the parameter values, but don't include the access token.
setycz
2 years agoExplorer | Level 3
This is the sample code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Dropbox.Api;
using Dropbox.Api.Team;
namespace DropBoxConnectorSample
{
internal class Program
{
private sealed class CustomWebRequestHandler : WebRequestHandler
{
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request,
CancellationToken cancellationToken)
{
var requestBody = await request.Content.ReadAsStringAsync();
Console.WriteLine(">>> " + requestBody);
var result = await base.SendAsync(request, cancellationToken);
var resultBody = await result.Content.ReadAsStringAsync();
Console.WriteLine("<<< " + resultBody);
return result;
}
}
private HttpClient CreateHttpClient()
{
var handler = new CustomWebRequestHandler
{
ReadWriteTimeout = 10 * 1000
};
if (handler.SupportsAutomaticDecompression)
handler.AutomaticDecompression = DecompressionMethods.Deflate
| DecompressionMethods.GZip;
return new HttpClient(handler) { Timeout = TimeSpan.FromHours(24) };
}
private DropboxTeamClient CreateTeamClientAsync()
{
var httpClient = CreateHttpClient();
const int retryCount = 4;
return new DropboxTeamClient("YOUR TOKEN",
new DropboxClientConfig(null, retryCount) { HttpClient = httpClient });
}
private async Task<string> FindMemberIdAsync(DropboxTeamClient client)
{
var criterium = new UserSelectorArg.Email("YOUR EMAIL");
var memberInfo = await client.Team.MembersGetInfoAsync(new[] { criterium }).ConfigureAwait(false);
var id = memberInfo.FirstOrDefault()?.AsMemberInfo?.Value?.Profile?.TeamMemberId;
if (id == null) throw new InvalidOperationException("Could not find a dropbox user.");
return id;
}
private async Task<DropboxClient> CreateClientAsync()
{
var teamClient = CreateTeamClientAsync();
var memberId = await FindMemberIdAsync(teamClient).ConfigureAwait(false);
return teamClient.AsMember(memberId);
}
public async Task<IEnumerable<string>> ListFoldersAsync(string relativePath)
{
var client = await CreateClientAsync().ConfigureAwait(false);
var folders = await client.Files.ListFolderAsync(relativePath).ConfigureAwait(false);
var result = folders.Entries.Where(e => e.IsFolder).Select(e => e.AsFolder.Name).ToList();
while (folders.HasMore)
{
folders = await client.Files.ListFolderContinueAsync(folders.Cursor).ConfigureAwait(false);
result.AddRange(folders.Entries.Where(e => e.IsFolder).Select(e => e.AsFolder.Name));
}
return result;
}
private static async Task Main(string[] args)
{
while (true)
{
var p = new Program();
var result = await p.ListFoldersAsync("/Test");
Console.WriteLine("END: " + string.Join(", ", result));
}
}
}
}
As you can see I have managed to dump the actual communication with DropBox servers.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 12 months agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!