One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
donaldp
4 years agoCollaborator | Level 9
SaveUrlAsync not downloading all requested files
Hi,
I'm updating an app I first worked on a couple of years ago. At that time I used SaveUrlAsync and it just worked. Well, I THINK it just worked - perhaps it was missing files and I hadn't noticed. Anyhow, now I am definitely missing files. i.e. in a batch of 20 file downloads, I'll typically be missing 3 or so. In fact in my most recent attempt I saw the files download out of order - out of the files that did download, most of them downloaded in order, and then files 2 and 4 popped up at the end after the others (but still some didn't appear at all). I didn't get any exceptions.
So I found this post https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/The-method-files-saveUrlCheckJobStatus-quot-asyncJobId-quot/m-p/201554 which mentions issues with a shared folder, which is what I'm working with. Tried changing to a non-shared folder but same issue.
I also tried checking the SaveUrlResult.IsComplete, and it said false for everything! (even the files I did have)
That other post has some code that doesn't seem applicable anymore, as it talks about SaveUrlResult.Tag, and the ".tag" doesn't seem to exist anymore.
Do you have some example C#/.NET code I can follow to make sure all the files download? I tried to follow the other example, but as I said the .tag isn't there anymore (well, at least it's not showing up in my Visual Studio Intellisense - maybe it's not public anymore?).
This is what I have at the moment...
public async Task<string> SaveFromURLAsync(string URL,string Filename)
{
string resultString=null;
try {
SaveUrlResult result=await DxClient.Files.SaveUrlAsync(Filename,URL);
resultString=result.IsComplete.ToString();
}
catch (Exception ex) {
DebugUtil.ConsoleWrite(debugOn,$"EXCEPTION IN SAVEFROMURLASYNC IS {ex.Message}");
}
return resultString;
}
Thanks,
Donald.
- Greg-DB
Dropbox Staff
Whenever you use SaveUrlAsync, you should also implement support for calling SaveUrlCheckJobStatusAsync, as you aren't guaranteed to get the completed result immediately on SaveUrlAsync. The SaveUrlResult from SaveUrlAsync can be either the complete result (IsComplete), or an async job ID (IsAsyncJobId).
If you get back a job ID, you'll need to poll SaveUrlCheckJobStatusAsync with that job ID to check the result. The .NET SDK doesn't have an example for that in particular, but you can call that method like the other methods in the SDK. Refer to the documentation linked above for more information on the options and types. Give that a try and let us know if you run in to any issues.
Also, note that the thread you linked to was discussing the Java SDK, not the .NET SDK, so the code won't be applicable.
- donaldpCollaborator | Level 9
Hi Greg, 🙂
"note that the thread you linked to was discussing the Java SDK"
Oh ok. No, I didn't notice that. No wonder there was some confusion. 😂
"the complete result (IsComplete)"Yeah I saw that through Intellisense and tried that to begin with, but as I said I was getting false returned for everything, even the ones that did work.
"you'll need to poll SaveUrlCheckJobStatusAsync with that job ID to check the result. The .NET SDK doesn't have an example for that in particular"
Ok, so more or less what was described in the other thread then. This is what I was going to try, but the non-existence of "tag" made me wonder if I was heading down the right path, and I couldn't find any sample code (also threw me that IsComplete was always false). I'll fiddle around with that a bit through Intellisense. I guess I'll do something like if (!IsComplete) then SaveURLCheckJobStatus(IsAsyncJobId). Thanks. 🙂 - donaldpCollaborator | Level 9
Hi Greg,
I've not changed any code at all since I was last working on this (was about to resume working on it), and now nothing at all is downloading - are you aware of any server issues with SaveFromURLAsync? Everything else is working (e.g. WriteFileAsync). There was some maintenance done just over 2 hours ago, which may be related.
The only change from before is I've updated Visual Studio today, which shouldn't affect it (in fact the reason I found SaveFromURLAsync wasn't working anymore was when I was testing out Visual Studio post-update). I even re-cloned from my last commit, when everything 100% was working, and same thing - nothing getting downloaded at all. Not on the Dropbox server either.
I already tagged Dropbox Support on Twitter, but thought I'd check in here too (I'm not sure what the preferred channel is when there's a suspected server issue - I figured Twitter would probably get noticed faster).P.S. it's failing silently - no exceptions or any other sort of error message, just no files at all.
P.P.S. I just tried downloading from a completely different website to rule that out, and again nothing downloaded, so it's not the source website either.
thanks,
Donald.
- Scott-DB
Dropbox Staff
Hi Donald, hopping on the thread here.
We did have some hiccups last night with the file saving system, and it's been resolved. Could you try again and let us know how it goes? Thanks!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,950 PostsLatest Activity: 23 hours ago
If 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!