You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
evry1falls
5 years agoCollaborator | Level 8
Check if Folder Exists
Can I do this in my code ?
Are there any better way ?
Public Async Function FolderExists(Client As DropboxClient, Optional Path As String = ("/Apps")) As Task(Of Boolean)
System.Diagn...
- 5 years ago
Yes, that sounds like a good way to handle the flow of checking for a particular folder and creating it if it doesn't exist.
Greg-DB
5 years agoDropbox Staff
To check if something exists at a particular path, you can instead use GetMetadataAsync. It would return the metadata if the item exists, or will raise an exception with LookupError.NotFound if not.
If you only want to check for one particular item, that may be easier/faster than looping through the entire parent folder listing.
Note that if you do use ListFolderAsync though, make sure you check the ListFolderResult.HasMore and call back to ListFolderContinueAsync if needed.
- evry1falls5 years agoCollaborator | Level 8
Greg-DB wrote:To check if something exists at a particular path, you can instead use GetMetadataAsync. It would return the metadata if the item exists, or will raise an exception with LookupError.NotFound if not.
If you only want to check for one particular item, that may be easier/faster than looping through the entire parent folder listing.
Note that if you do use ListFolderAsync though, make sure you check the ListFolderResult.HasMore and call back to ListFolderContinueAsync if needed.
100% correct.
I my case, I'm using just one FOLDER to enable users to backup thier Database file of a certain version [Thier version] and when updating thier application version later, the app compairs the offline version with the online version of just One File in just One Folder.
But I will try GetMetadataAsync
and if raises an error [Not found] then I will automatically let the app do [CreateFolderArge] accordingly. What do you think?!- Greg-DB5 years agoDropbox Staff
Yes, that sounds like a good way to handle the flow of checking for a particular folder and creating it if it doesn't exist.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 4 days 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!