cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Dropbox API

Dropbox API

solsupp
Explorer | Level 3

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 9

Greg-DB
Dropbox Staff

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.

solsupp
Explorer | Level 3
Ah 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-DB
Dropbox Staff

No, for a link created using CreateSharedLinkWithSettingsAsync with the default settings, the recipient does not need to be signed in.

solsupp
Explorer | 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 Function

I 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-DB
Dropbox Staff

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.

 

solsupp
Explorer | Level 3
Thanks, 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-DB
Dropbox Staff

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.

solsupp
Explorer | 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-DB
Dropbox Staff

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.

Need more support?