Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
solsupp
7 years agoExplorer | Level 3
Dropbox API
Just programatically created a file sharing link in VB .net, once a recipient click on the link they get a message "You don’t have access to this content. You’re signed in as xxxx@xxxxx.
I just want recipient to be able to download or view uploaded file, is this possible, am I missing a step for sharing the file.
9 Replies
- Greg-DB7 years ago
Dropbox Community Moderator
You should be able to create a shared link that anyone can access using CreateSharedLinkWithSettingsAsync. (Though, content may be subject to team and/or shared folder policies.)
Is that what you're using? Please share the code/output if something isn't working as expected.
- solsupp7 years agoExplorer | Level 3Ah ok, does the recipient still need to be logged into Dropbox, I was hoping to send link that anyone can download without having to log in.
- Greg-DB7 years ago
Dropbox Community Moderator
No, for a link created using CreateSharedLinkWithSettingsAsync with the default settings, the recipient does not need to be signed in.
- solsupp7 years agoExplorer | Level 3
I use :
Private Async Function Dropboxnotification(path As [String], stream As FileStream, chunkSize As Integer, dbx As DropboxClient, filepath As String) As Task Dim updated As Task(Of ShareFolderLaunch) = Nothing updated = dbx.Sharing.ShareFolderAsync(filepath, Nothing, True) Dim myShared As Task(Of SharedFileMetadata) = Nothing myShared = dbx.Sharing.GetFileMetadataAsync(path) Dim myuploaded As ShareFolderJobStatus = Nothing Dim myPreview As SharedFolderMetadata = Nothing Dim mySharedLink As SharedLinkMetadata = Nothing Dim myDropBoxLink As String = Nothing Try If updated.Result.AsAsyncJobId.Value IsNot Nothing Then Dim myUploadReady As Boolean = False Dim myLinkReady As Boolean = False Do Until myUploadReady = True myuploaded = Await dbx.Sharing.CheckShareJobStatusAsync(updated.Result.AsAsyncJobId.Value) If myuploaded.IsComplete = True Then myPreview = myuploaded.AsComplete.Value myDropBoxLink = myPreview.PreviewUrl myUploadReady = True Exit Do End If Loop Dim myIssueID As Integer = CInt(GridView1.GetRowCellValue(GridView1.FocusedRowHandle, "Issue_ID").ToString) Dim myMembers() As AddMember = Nothing Me.Draw_issuesTableAdapter.UpdateDropboxLink(myDropBoxLink, myIssueID) GridView1.SetRowCellValue(GridView1.FocusedRowHandle, "XXXlong", myDropBoxLink) 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) Try If myPreview.SharedFolderId 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))} Await dbx.Sharing.AddFolderMemberAsync(myPreview.SharedFolderId, 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 Catch ex As SystemException End Try End If End If Catch ex As System.AggregateException If ex.HResult = -2146233088 Then 'DevExpress.XtraEditors.XtraMessageBox.Show("This file already exists, cannot upload!", "oops, something has happened!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information, System.Windows.Forms.MessageBoxDefaultButton.Button1) Exit Function End If End Try End FunctionI get exception that shared link aleady exists, if i try to use CreateSharedLinkWithSettingsAsync , can I return the shared link from already shared file, not the url, as the returned url needs user to be signed in.
- Greg-DB7 years ago
Dropbox Community Moderator
In the code you shared here, you're getting the PreviewUrl for the shared folder, which does require members to be signed in.
If you want a shared link that anyone can access, you should use CreateSharedLinkWithSettingsAsync. If a shared link already exists, that will give you a CreateSharedLinkWithSettingsError.SharedLinkAlreadyExists, in which case you can call ListSharedLinksAsync instead to get the existing link.
- solsupp7 years agoExplorer | Level 3Thanks, one more question, I maybe need to view the files from the folder, as the file I upload is a zip file, is there an equivalent shared folder link?
- Greg-DB7 years ago
Dropbox Community Moderator
The CreateSharedLinkWithSettingsAsync method can be used to create shared links for files or folders.
If you access a shared link for a zip file in particular, the Dropbox web site will allow the user to browse through the contents of the zip file.
- solsupp7 years agoExplorer | Level 3
How do I check a shared link exists, I am using
Dim mySharedFolderLink As Task(Of SharedLinkMetadata) = Nothing
mySharedFolderLink = dbx.Sharing.CreateSharedLinkWithSettingsAsync(path)Not sure what to do next, to find out if folder exists
- Greg-DB7 years ago
Dropbox Community Moderator
When calling CreateSharedLinkWithSettingsAsync, if a shared link for the requested item already exists, it will throw an ApiException with CreateSharedLinkWithSettingsError.SharedLinkAlreadyExists.
You can then call ListSharedLinksAsync to get the existing link.
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
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!