Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Now have large data upload working, only 1 thing I cant do is share the folder. Errors on bold text, how do I get the parent shared folder ID after upload.
Private Async Function ChunkUpload(path As [String], stream As FileStream, chunkSize As Integer, dbx As DropboxClient) As Task
Dim numChunks As Integer = CInt(Math.Ceiling(CDbl(stream.Length) / chunkSize))
Dim buffer As Byte() = New Byte(chunkSize - 1) {}
Dim sessionId As String = Nothing
For idx = 0 To numChunks - 1
Dim byteRead = stream.Read(buffer, 0, chunkSize)
Using memStream = New MemoryStream(buffer, 0, byteRead)
If idx = 0 Then
Dim result = Await dbx.Files.UploadSessionStartAsync(False, memStream)
sessionId = result.SessionId
Else
Dim cursor = New UploadSessionCursor(sessionId, CULng(CUInt(chunkSize) * CUInt(idx)))
If idx = numChunks - 1 Then
Dim fileMetadata As FileMetadata = Await dbx.Files.UploadSessionFinishAsync(cursor, New CommitInfo(path), memStream)
Console.WriteLine(fileMetadata.PathDisplay)
Dim myIssueID As Integer = CInt(GridView1.GetRowCellValue(GridView1.FocusedRowHandle, "Issue_ID").ToString)
Dim myMembers() As AddMember = Nothing
If GridView1.SelectedRowsCount > 0 Then
Dim myIssueRecipientsDatatable As System.Data.DataTable
Dim myIssueRecipientsTableAdapter As ArchetypeDBDataSetTableAdapters.draw_issueesTableAdapter = New ArchetypeDBDataSetTableAdapters.draw_issueesTableAdapter
myIssueRecipientsDatatable = myIssueRecipientsTableAdapter.GetDataByIssueID(False, myIssueID)
If fileMetadata.SharingInfo.ParentSharedFolderId IsNot Nothing Then
For Each myIssuee As DataRow In myIssueRecipientsDatatable.Rows
If myIssuee.Item("DREASON").ToString IsNot Nothing Then
myMembers = {New AddMember(New MemberSelector.Email(myIssuee.Item("DREASON").ToString), Nothing)}
Await dbx.Sharing.AddFolderMemberAsync(fileMetadata.SharingInfo.ParentSharedFolderId, myMembers, False, "A Document Issue has been created by " & fnGetCompanyName() & " as you are part of the issue distribution, this ZipFile has been made available to you.")
End If
Next
End If
End If
MsgBox("Successfully Uploaded")
Else
Await dbx.Files.UploadSessionAppendV2Async(cursor, False, memStream)
End If
End If
End Using
Next
End Function
Making the call and catching that exception is fine, but if you want to check beforehand, you can call FilesUserRoutes.GetMetadataAsync for the folder itself and check the returned FolderMetadata.SharingInfo. (Or, you can list all of the shared folders on the account using SharingUserRoutes.ListFoldersAsync/SharingUserRoutes.ListFoldersContinueAsync.)
Hi there!
If you need more help you can view your support options (expected response time for a 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!