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

Ghislain Sommervogel's avatar
Ghislain Sommervogel
Helpful | Level 5
5 months ago

.NET API : How to read subfolders of team folders not assigned to the connected user?

Hello,

I’m developing a .NET application to automate a few tasks in Dropbox. Specifically, I need to access team folders and their subfolders. For team folders, I’m using the `DropboxTeamClient.Team.TeamFolderListAsync()` API function. I’m able to retrieve the expected items. However, I can’t figure out how to read the content of these team folders. The documentation and forums suggest using `DropboxClient.Files.ListFolderAsync()`. But when I do this, I only can read the content of my personal folders. The specific team folder I want to access does not appear.

I’ve carefully read the following article: https://developers.dropbox.com/fr-fr/dbx-team-files-guide. With additional information from forums, I understand that I need to:

- Connect as an administrator using the `DropboxTeamClient.AsAdmin()` function.
- Reposition the root folder using the `DropboxClient.WithPathRoot()` function.

Combining these two approaches does indeed extend my permissions and changes the root from which I access folders, allowing me to view the team folders I natively have access to. However, I still don’t see the team folder I’m interested in.

The workaround I’ve used for now is to modify my profile to assign the folder in question to my account. But this means that in order to fully inventory all team folders and control the permissions on their subfolders, I would have to assign myself all of the team folders. And potentially do the same for any other user of my application. This approach seems less than ideal. Especially since, through the admin console, I can easily view the contents of team folders. So, there must be a way to do this with the API without assigning the folders to myself, but I can’t find it.

Thanks for your help!

  • When using the .NET SDK, using the TeamFolderListAsync method is the right way to begin listing all of the team folders for a team. Be sure to also implement TeamFolderListContinueAsync as well though, to make sure you get the whole list.

     

    And then for any given team folder (or any folder), using ListFolderAsync and likewise ListFolderContinueAsync is the right way to list the contents of the folder. Note that if you need all of the nested entries, you'll need to set recursive: true.

     

    But to access a team folder that your account isn't a member of, you will need to make some adjustments to the client, as you noted. You will need to:

    There's a blog post and accompanying code sample here about effectively the same strategy (for all team namespaces, not just team folders) if you'd like to see an example of it. The sample is written in Python, but the logic is the same.

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

    When using the .NET SDK, using the TeamFolderListAsync method is the right way to begin listing all of the team folders for a team. Be sure to also implement TeamFolderListContinueAsync as well though, to make sure you get the whole list.

     

    And then for any given team folder (or any folder), using ListFolderAsync and likewise ListFolderContinueAsync is the right way to list the contents of the folder. Note that if you need all of the nested entries, you'll need to set recursive: true.

     

    But to access a team folder that your account isn't a member of, you will need to make some adjustments to the client, as you noted. You will need to:

    There's a blog post and accompanying code sample here about effectively the same strategy (for all team namespaces, not just team folders) if you'd like to see an example of it. The sample is written in Python, but the logic is the same.

    • Ghislain Sommervogel's avatar
      Ghislain Sommervogel
      Helpful | Level 5

      Hi Greg,

      Thanks for your reply. I'm just wondering how to get the NamespaceId for a specific team folder. I don't see this information in the TeamFolderMetadata class. And your example in the blog post is quite different because the starting point is a DropboxTeamClient.Team.NamespacesListAsync() call, instead of a TeamFolderListAsync() call. Obviously you get the NamespaceId in the result. Or do you suggest I switch to NamespacesListAsync()?

      Best regards,

      Ghislain

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

        You don't need to switch to listing all of the namespaces unless your use case requires it. Team folders are just one type of namespace, so your scenario is effectively a subset of that example.

         

        The namespace ID for a team folder is the team folder ID, so you can get the team folder's namespace ID from the TeamFolderMetadata.TeamFolderId.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,915 PostsLatest Activity: 22 hours ago
333 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!