You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

amedeomantica's avatar
amedeomantica
Explorer | Level 4
7 years ago

How to access Team Folders with Java API ?

Hi, I'm using dropbox V2 API with the Java library: dropbox-sdk-java While I can access all team member's folders I cannot figure out how to access the global Team Folders. Any hint ? Thank you A...
  • chirstius's avatar
    chirstius
    7 years ago

    Thank you for posting those samples amedeomantica

     

    Because your Dropbox Team uses team space and member folders I'd like to make a suggestion. First, make sure you have the latest Java SDK (3.0.7).

     

    Then add a call to get the current account information and root namespace:

     

    FullAccount account = adminClient.users().getCurrentAccount();
    String rootNS = account.getRootInfo().getRootNamespaceId();

     

     

    Next, replace your call to listFolder() with this:

     

     

    final ListFolderResult listFolderResult = dropBoxConnection.memberClient().withPathRoot(PathRoot.namespaceId(rootNS)).files().listFolder(path);

     

    If there are issues with that, you can try varying the composition of your path string - try just using the literal string pathname vs the "ns:" format. Remember that all pathing will be relative to the root namespace (the Team root folder).

     

    What the withPathRoot() method does is to "root" the chained API call at the given namespace. In your case, while you may have the proper namespace ID for the Team Folder, if you are not accessing it via the root namespace ID, it will not be visible to your user. This is because by default all calls without an explicit path root set are rooted in the home namespace (your user folder), not the team root where Team Folders live.

     

    I suggest looking over "User's Home Folder & Team Root Folder" and the "Using a Namespace to Identify Content" in the Namespace Guide:

    https://www.dropbox.com/developers/reference/namespace-guide

     

    Hopefully, this gets you past the error.

     

    -Chuck

     

     

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,882 PostsLatest Activity: 20 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!