Forum Discussion

solsupp's avatar
solsupp
Explorer | Level 3
8 years ago

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>")
        Dim fs = New FileStream(fileSource, FileMode.Open, FileAccess.Read)
        Dim updated = dbx.Files.UploadAsync((filePath + ("/" + fileName)), WriteMode.Overwrite.Instance, body:=fs)

End Sub

 

To upload a folder and file.

 

How can I then share this folder with a specific email addres, I wish to then notifiy that email address that a share has been created for them.

14 Replies

Replies have been turned off for this discussion
  • solsupp's avatar
    solsupp
    Explorer | Level 3
    8 years ago

    Have also tried:

     

    Dim slm = dbx.Files.GetMetadataAsync((filePath))
                        MsgBox(slm.Result.ParentSharedFolderId)
    

    Returns nothing

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago

    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.

  • solsupp's avatar
    solsupp
    Explorer | Level 3
    8 years ago

    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 Function

      ShareFolderAsync(filePath, Nothing, True, Nothing, Nothing, Nothing, Nothing, Nothing) - Folder doesn't get shared.

     

  • solsupp's avatar
    solsupp
    Explorer | Level 3
    8 years ago

    got it with

     

     dbx.Sharing.ShareFolderAsync(filePath)

     

    all working now

About Dropbox API Support & Feedback

Node avatar for 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!