We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here. 

Forum Discussion

Faulk's avatar
Faulk
Explorer | Level 4
2 years ago

Can't Access Business Account Root Folders from Dropbox Client App

Hello,

 

Our company has a business advanced account, with members managed through Azure AD. At the root are two folders: one for my account, "Faulk", and another intended to house externally managed documents, call it "Work".

 

Our intention is to manage the contents of Work externally through the API, uploading, downloading, and deleting files in a folder structure, authenticating using a Dropbox App rather than an Azure account.

 

I created an app in the App Console, gave it scope permissions (account_info.read, files.metadata.read, files.content.write, files.content.write, sharing.write, sharing.read), connected the app using oauth2/authorize including the client id and "token_access_type=offline&response_type=code". I then called oauth2/token, passing the code, and received an access token.

 

With this access token, files/list_folder only returns the contents of the Faulk folder.

Calling sharing/list_folders return Work, Faulk, and the contents of Faulk.

 

Adding the shared link for Work to files/list_folder returns the contents of Work, but doesn't include shared links or id's I can use to manage that content. Altering the "path" value didn't work either.

 

Other details: my account is an admin, I've tried adding Team scopes to the app with no success (using Dropbox-API-Select-User or Dropbox-API-Select-Admin produced the same results when calling files/list_folder), calling sharing/mount_folder for Work tells me "This shared folder has already been added."

 

My questions are:

Is it possible to view/manage files and folders within the parent business account using a Dropbox app in this manner?

Should the app have been created under a different account?

 

I feel like this issue is similar to this post: https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Get-list-of-files-in-folders-inside-shared-folders/td-p/278501, but the solution in their case concerned sharing across different dropbox accounts, not accessing different folders within a parent business account.

 

Thanks very much for any help you can offer!

 

Edit: as an addendum the Faulk folder shows as a Shared folder type, while the Work folder shows as a Team folder type. Also, when using Dropbox-API-Select-Admin with any of the other admin's accounts files/list_folder returns no results (they do not have personal folders).

 

Edit2: complicating things possibly: prior to my company setting up the business account I had set up a personal account using my company email address. Once the business account was created, the personal account was merged into the business account, which is where the Faulk folder came from.

 

 

 

 

 

  • Hi Faulk,

    By default the point assumed to be root for API access is users home folder (i.e. your Faulk folder), not the account root. If you want to change this root to any other namespace (including to account root), you need to use Dropbox-API-Path-Root header. 😉

    Hope this helps.

    • Faulk's avatar
      Faulk
      Explorer | Level 4

      You are 100% correct. Been beating my head against the wall for hours and it was that easy. For anyone coming across this, the corrective steps were:

       

      • Call users/get_current_account and grab the "root_namespace_id" value from the account result.
      • Add a Dropbox-API-Path-Root header with a value {".tag": "namespace_id", "namespace_id": "<that value>"} to the files/list_folder call.

      From there you can adjust the path value as needed.

       

      For those using the SDK, here's an example (.net):

       

      using (DropboxClient client = new DropboxClient(<accessToken>).WithPathRoot(new Dropbox.Api.Common.PathRoot.NamespaceId(<root path id>)))
      {

      }

       

      Thanks so much for your help and quick reply!

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    Faulk Ð—дравко is right; it sounds like you want to access the "team space". You can certainly do so from any account that has access to the team space, but by default, API calls operate in the "member folder" of the connected account, not the team space. You can configure API calls to operate in the team space instead though. To do so, you'll need to set the "Dropbox-API-Path-Root" header. You can find information on this in the Team Files Guide.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,876 PostsLatest Activity: 3 hours ago
325 Following

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 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!