cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

Download shared folders via /2/files/download call

Explorer | Level 4

I've been calling /2/files/list_folder and then calling /2/files/download to download all files of a specific user. However, I noticed that I'm not able to download the content of the following types:

 

Team Folders

Shared Folders

 

I'm not worried about the team folders but I would like the ability to download all content within the shared folders (Most of these folders are shared between users and do not have a link created, for what it's worth). I've got the recursive param set to "true" and I see regular folders displaying child files but nothing appears for the shared folders other than the folder itself. I'm using the DropBox Buisness API (Team member file access) for authentication. Any help is greatly appreciated.

1 Accepted Solution

Accepted Solutions
Highlighted

Re: Download shared folders via /2/files/download call

Dropboxer
Dropboxer

The /2/files/list_folder[/continue] interface is paginated, and you're not guaranteed to get all of the results on the first page. You need to check the `has_more` value in the response, and call back to /2/files/list_folder/continue, if it's true. Keep calling back to retrieve all of the pages until `has_more` is false in order to get all of the entries. You can find more information in the /2/files/list_folder documentation.

View solution in original post

2 Replies 2
Highlighted

Re: Download shared folders via /2/files/download call

Dropboxer
Dropboxer

The /2/files/list_folder[/continue] interface is paginated, and you're not guaranteed to get all of the results on the first page. You need to check the `has_more` value in the response, and call back to /2/files/list_folder/continue, if it's true. Keep calling back to retrieve all of the pages until `has_more` is false in order to get all of the entries. You can find more information in the /2/files/list_folder documentation.

View solution in original post

Highlighted

Re: Download shared folders via /2/files/download call

Explorer | Level 4

Hmmm, I kept getting errors when I was trying to paiginate via PowerShell but didn't have any issues when I used requests via Python. Well, thanks for all your help Greg, really appreciate it!

 

Here's the PowerShell code I was using:

 

$arg = '{"path": "","recursive": true,"include_media_info": false,"include_deleted": false,"include_has_explicit_shared_members": false,"include_mounted_folders": true}'


$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", $token)
$headers.Add("Dropbox-API-Select-User", $dbmid)
    
$Folders = Invoke-RestMethod -Uri https://api.dropboxapi.com/2/files/list_folder -Method Post -Headers $headers -ContentType "application/json; charset=utf-8" -body $arg
$allFiles = $folders.entries.path_display


while ($folders.has_more -eq "True") {
    $json = '{"cursor": "' + $folders.cursor + '"}'
    $json
    $folders = Invoke-RestMethod -Uri https://api.dropbox.com/2/files/list_folder/continue -Body $json -ContentType "application/json; charset=utf-8" `
        -Headers @{ Authorization = $token } -Method Post
    $allFiles += $folders.entries.path_display
}

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?