We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
solsupp
8 years agoExplorer | Level 3
Folders
I am surrently using:
Private Shared Sub FileUploadToDropbox(ByVal filePath As String, ByVal fileName As String, ByVal fileSource As String) Dim dbx = New DropboxClient("<REDACTED>") ...
solsupp
8 years agoExplorer | Level 3
Thanks for that, apologies, I am a newby here, 1 more question, how do I get a folderID, can I quierie it based on folder name?
Greg-DB
Dropbox Community Moderator
8 years agoYou can get the shared folder ID from SharedFolderMetadata.SharedFolderId (e.g., from a completed ShareFolder job, or elsewhere, such as from ListFolders/ListFoldersContinue) or from FolderSharingInfo.SharedFolderId in FolderMetadata.SharingInfo (e.g., from ListFolder/ListFolderContinue or GetMetadata).
- solsupp8 years agoExplorer | Level 3
Are there any examples in the API, have googled this, but not sure how to apply this to code.
Just want FolderID based on folder name if possible.
Dim link = dbx.Sharing.GetFolderMetadataAsync((filePath + ("/" + fileName))) Dim myMembers() As AddMember = {New AddMember(New MemberSelector.Email("EMAILADDRESS"), Nothing)} dbx.Sharing.AddFolderMemberAsync(link.Id.ToString, myMembers, False, "Docs Uploaded")Get error:
System.ArgumentOutOfRangeException: Value should match pattern '\A(?:[-_0-9a-zA-Z:]+)\z'
- Greg-DB8 years ago
Dropbox Community Moderator
In this code, you're just using 'Id'. You need the 'SharedFolderId'. In your code, that should be something like:
link.SharingInfo.SharedFolderId
- solsupp8 years agoExplorer | Level 3
link.SharingInfo.SharedFolderId not available in LINK, only have link.id available
Dim link = dbx.Files.ListFolderAsync(filePath + ("/" + fileName)) - Is this correct
I am worndering if I am going about this the wrong way, What if I have no sharing on a folder?
I want to share the above folder, if its not shared, will sharedfolderID be null.
- solsupp8 years agoExplorer | Level 3
Have also tried:
Dim slm = dbx.Files.GetMetadataAsync((filePath)) MsgBox(slm.Result.ParentSharedFolderId)Returns nothing
- Greg-DB8 years ago
Dropbox Community Moderator
Apologies, I believe I misread your code.
The SharedFolderId field is only available on folders that are shared. I see that you were actually calling GetMetadata (as far as I can tell, from the variable names you're using), so that won't be available. You should call that on the folder itself to get that instead. I.e., to get a FolderMetadata object.
If you call GetMetadata for a file, you will get a FileMetadata object. If the file is in a shared folder, you can get the parent shared folder ID, i.e., the shared folder ID for the shared folder the file is contained in, from FileSharingInfo.ParentSharedFolderId in FileMetadata.SharingInfo.
And that's correct, if the folder is not yet shared, it won't have a shared folder ID. You should call ShareFolder as discussed earlier to share a folder.
- solsupp8 years agoExplorer | Level 3
Still not sure what to do here, I have searched the forum, googled it, but cant find any examples of useage anywhere?
Do you have an example of sharing a folder - Event if its in c#, I can convert it. The function exmaple seems to do nothing.
Public Function ShareFolderAsync( path As String, Optional aclUpdatePolicy As AclUpdatePolicy = Nothing, Optional forceAsync As Boolean = False, Optional memberPolicy As MemberPolicy = Nothing, Optional sharedLinkPolicy As SharedLinkPolicy = Nothing, Optional viewerInfoPolicy As ViewerInfoPolicy = Nothing, Optional actions As IEnumerable(Of FolderAction) = Nothing, Optional linkSettings As LinkSettings = Nothing ) As Task(Of ShareFolderLaunch) End FunctionShareFolderAsync(filePath, Nothing, True, Nothing, Nothing, Nothing, Nothing, Nothing) - Folder doesn't get shared.
- solsupp8 years agoExplorer | Level 3
got it with
dbx.Sharing.ShareFolderAsync(filePath)
all working now
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!