Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Boneless
5 years agoHelpful | Level 6
How to get team root folder by SwiftyDropbox?
Hi Dropbox Forum,
I want to get team root folder by SwiftyDropbox. but fail.
this is what I do
1.Set .plist file
2.Set AppKey in AppDelegate
DropboxClientsManager.setupWithA...
- 5 years ago
Thank you!
We solved the problem of setting "withPathRoot" by SwiftyDropbox.
For other people has the same problem, I record what I do here.
I set class variable as you said(Most important).
var dropboxClient:DropboxClient?login then do those things
dropboxClient = DropboxClientsManager.authorizedClient dropboxClient?.users.getCurrentAccount().response(completionHandler: {user, error in let rootNamespaceId = user?.rootInfo.rootNamespaceId if rootNamespaceId != nil{ self.dropboxClient = DropboxClientsManager.authorizedClient?.withPathRoot(.namespaceId(user?.rootInfo.rootNamespaceId ?? "")) } self.dropboxClient?.files.listFolder(path: self.filePath).response(completionHandler: {response, error in //Parse if response?.entries != nil{ self.parseDropboxEntries(entries: response!.entries) } }) })
Greg-DB
Dropbox Community Moderator
5 years agoYes, the withPathRoot method is the right way to access different roots. I just tried it and it is working for me.
Can you clarify what you mean when you say you tried many ways to keep the client variable? What did you use exactly?
In my own testing I am able to reproduce the "-999" error you're getting when I only define the client locally. It's fixed when I define it as a class variable though, e.g., as `var client : DropboxClient?`.
Boneless
5 years agoHelpful | Level 6
Thank you!
We solved the problem of setting "withPathRoot" by SwiftyDropbox.
For other people has the same problem, I record what I do here.
I set class variable as you said(Most important).
var dropboxClient:DropboxClient?
login then do those things
dropboxClient = DropboxClientsManager.authorizedClient
dropboxClient?.users.getCurrentAccount().response(completionHandler: {user, error in
let rootNamespaceId = user?.rootInfo.rootNamespaceId
if rootNamespaceId != nil{
self.dropboxClient = DropboxClientsManager.authorizedClient?.withPathRoot(.namespaceId(user?.rootInfo.rootNamespaceId ?? ""))
}
self.dropboxClient?.files.listFolder(path: self.filePath).response(completionHandler: {response, error in
//Parse
if response?.entries != nil{
self.parseDropboxEntries(entries: response!.entries)
}
})
})
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!