Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Ghislain Sommervogel
2 years agoHelpful | Level 5
.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...
- 2 years ago
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:
- use DropboxTeamClient.AsAdmin to get a DropboxClient to perform the calls as an admin
- use DropboxClient.WithPathRoot using that DropboxClient to access the desired team folder. Note that in this case though, you'll want to use the (less common) PathRoot.NamespaceId mode to access the specific team folder namespace by specifying the namespace ID for the desired team folder (as opposed to the more common PathRoot.Root mode, which would access only what's in the team space for the particular connected account).
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
2 years agoHelpful | Level 5
Hi Greg,
Your approach works perfectly... but triggers a new problem for the next step of my to-do list. I need to copy one of the subfolder of "team folder B" (=PathRoot of my dropboxclient) in a specific directory of "team folder A". Because of the namespaceid relocation, the source path and target path of CopyV2Async share no common root. Is there a way to solve this? In the admin console, I just click on "copy" on the right and the console let me select the target location, so I assume there is a way! 😉
Ghislain Sommervogel
2 years agoHelpful | Level 5
I think I've found the way. First set PathRoot to A NamespaceID. Use Files.CopyReferenceGetAsync(). Then set PathRoot to B NamespaceID and finally use Files.CopyReferenceSaveAsync(). Am I right? Thank you!
- Greg-DB2 years ago
Dropbox Community Moderator
Yes, you can use copy references if you'd like.
Alternatively, you should also be able to use CopyV2Async as an admin from one team folder and specify the destination in the other team folder in the toPath using the format "ns:12345/copyname" where 12345 is the team folder ID of the destination team folder.
- Ghislain Sommervogel2 years agoHelpful | Level 5
My approach does not work : I get a "no_permission" error when calling CopyReferenceGetAsync() (with classical paths, I didn't test the "ns:xxx/copyname" syntax)
But yours did the trick 😉
Thank you very much for your help!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!