<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to get team root folder by SwiftyDropbox? in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/497127#M24748</link>
    <description>&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;We solved the problem of setting "withPathRoot" by&amp;nbsp;SwiftyDropbox.&lt;/P&gt;&lt;P&gt;For other people has the same problem, I&amp;nbsp;record what I do here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I set class variable as you said(Most important).&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var dropboxClient:DropboxClient?&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;login then do those things&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;        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)
                }
                
            })
        })&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Feb 2021 08:02:44 GMT</pubDate>
    <dc:creator>Boneless</dc:creator>
    <dc:date>2021-02-17T08:02:44Z</dc:date>
    <item>
      <title>How to get team root folder by SwiftyDropbox?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/492137#M24609</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi Dropbox Forum,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to get team root folder by SwiftyDropbox. but fail.&lt;/P&gt;
&lt;P&gt;this is what I do&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.Set&amp;nbsp;.plist file&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2.Set&amp;nbsp;&lt;SPAN class="s2"&gt;AppKey in&amp;nbsp;&lt;/SPAN&gt;AppDelegate&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;DropboxClientsManager.setupWithAppKey("xxxxxxx")&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3.authorization(use team account login)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        if let _ = DropboxClientsManager.authorizedTeamClient {
            DropboxClientsManager.unlinkClients()
        }
        
        if let _ = DropboxClientsManager.authorizedClient {
            DropboxClientsManager.unlinkClients()
        }

DropboxClientsManager.authorizeFromController(UIApplication.shared,
                                                      controller: self,
                                                      openURL: { (url: URL) -&amp;gt; Void in
                                                        UIApplication.shared.open(url, options: [:], completionHandler: {success in
                                                            if success{
                                                                print("Open URL success")
                                                            }else{
                                                                print("Open URL fail")
                                                            }
                                                        })
        })&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. then in&amp;nbsp;AppDelegate&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;func&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;application&lt;/SPAN&gt;(&lt;SPAN class="s1"&gt;&lt;STRONG&gt;_&lt;/STRONG&gt;&lt;/SPAN&gt; app: &lt;SPAN class="s3"&gt;UIApplication&lt;/SPAN&gt;, open url: &lt;SPAN class="s3"&gt;URL&lt;/SPAN&gt;, options: [&lt;SPAN class="s3"&gt;UIApplication&lt;/SPAN&gt;.&lt;SPAN class="s3"&gt;OpenURLOptionsKey&lt;/SPAN&gt; : &lt;SPAN class="s1"&gt;&lt;STRONG&gt;Any&lt;/STRONG&gt;&lt;/SPAN&gt;]) -&amp;gt; &lt;SPAN class="s3"&gt;Bool&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        let oauthCompletion: DropboxOAuthCompletion = {
            
            if let authResult = $0 {
                switch authResult {
                case .success:
                    print("Success! User is logged into DropboxClientsManager.")
                    
                    let a = client?.users.getCurrentAccount()
                    a?.response(completionHandler: { user, error in
                        print("user:\(user), error: \(error)")
                        print("accountType:\(user?.accountType)")
                        print("rootNamespaceId:\(user?.rootInfo.rootNamespaceId)")
                    })
                    
                case .cancel:
                    print("Authorization flow was manually canceled by user!")
                    
                case .error(_, let description):
                    print("Error: \(String(describing: description))")
                    
                    let hud = MBProgressHUD.showAdded(to: UIApplication.shared.keyWindow!, animated: true)
                    hud.label.text = "Login failed"
                    hud.hide(animated: true, afterDelay: 1)
                    
                }
            }
        }

DropboxClientsManager.handleRedirectURL(url, completion: oauthCompletion)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;5. Set a button to&amp;nbsp;listFolder&lt;/P&gt;
&lt;P&gt;I see this post&amp;nbsp; "Using the Dropbox-API-Path-Root Header", but don't know how to set it in&amp;nbsp;SwiftyDropbox.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.dropbox.com/lp/developers/reference/dbx-team-files-guide#namespaces" target="_blank" rel="noopener"&gt;https://www.dropbox.com/lp/developers/reference/dbx-team-files-guide#namespaces&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;func getList(){&lt;BR /&gt;  let client = DropboxClientsManager.authorizedClient?.withPathRoot(.namespaceId("xxxxxx"))//root_namespace_id get from oauthCompletion
  client?.users.getCurrentAccount().response(completionHandler: {user, error in print("user:\(user) error:\(error)")})&lt;BR /&gt;
  client?.files.listFolder(path: filePath ,includeMountedFolders: true).response(completionHandler: {response, error in
           
            if response?.entries != nil{
                self.parseDropboxEntries(entries: response!.entries)
            }
            
        })&lt;BR /&gt;}&lt;/PRE&gt;
&lt;P&gt;it show error and can't list folder:&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;P class="p1"&gt;&lt;STRONG&gt;user:nil error:Optional(Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=&lt;A href="https://api.dropbox.com/2/users/get_current_account" target="_blank" rel="noopener"&gt;https://api.dropbox.com/2/users/get_current_account&lt;/A&gt;, NSErrorFailingURLKey=&lt;A href="https://api.dropbox.com/2/users/get_current_account" target="_blank" rel="noopener"&gt;https://api.dropbox.com/2/users/get_current_account&lt;/A&gt;, _NSURLErrorRelatedURLSessionTaskErrorKey=(&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;STRONG&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;"LocalDataTask &amp;lt;xxxxxxxxxxxxxxxxxxxxxxxxxxx&amp;gt;.&amp;lt;1&amp;gt;"&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;STRONG&gt;), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask &amp;lt;xxxxxxxxxxxxxxxxxxxxxxxxxxx&amp;gt;.&amp;lt;1&amp;gt;, NSLocalizedDescription=cancelled})&lt;/STRONG&gt;&lt;/P&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Can anyone help me ? thank you&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV class="gtx-trans-icon"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 01 Feb 2021 07:06:46 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/492137#M24609</guid>
      <dc:creator>Boneless</dc:creator>
      <dc:date>2021-02-01T07:06:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to get team root folder by SwiftyDropbox?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/492551#M24619</link>
      <description>&lt;P&gt;I see you're using a 'client' object defined in your 'getList' method. It's possible this client object is going&amp;nbsp;out of scope before the request finishes, which could cause this kind of failure. (API calls are made asynchronously, as they require network calls.) You should keep that client object in scope instead. For instance, you can save it as a variable in the relevant class itself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For reference, using &lt;A href="https://dropbox.github.io/SwiftyDropbox/api-docs/latest/Classes/DropboxClient.html#/s:13SwiftyDropbox0B6ClientC12withPathRootyAcA6CommonC0eF0OF" target="_self"&gt;the&amp;nbsp;withPathRoot method&lt;/A&gt; is the right way to set the "Dropbox-API-Path-Root" header in the&amp;nbsp;Dropbox Swift SDK.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2021 17:14:42 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/492551#M24619</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-02-01T17:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to get team root folder by SwiftyDropbox?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/492728#M24629</link>
      <description>&lt;P&gt;Thank for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I open any&amp;nbsp;&lt;SPAN&gt;Team Scopes and use&amp;nbsp;DropboxClientsManager.authorizeFromController, When my app jump to the Dropbox app forauthorize, it will show error message.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-SPOILER&gt;&lt;P&gt;Error loading app info&lt;/P&gt;&lt;P&gt;An unknow error occurred&lt;/P&gt;&lt;/LI-SPOILER&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I close all&amp;nbsp;&lt;SPAN&gt;Team Scopes and don't set withPathRoot.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;let client = DropboxClientsManager.authorizedClient?.withPathRoot(.namespaceId("xxxxxx"))&lt;/PRE&gt;&lt;P&gt;I can successful get "member folder" (purple) ,but I want to get&amp;nbsp;&lt;SPAN&gt;"team folders" (blue)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please tell me&amp;nbsp;how to solve this error, thank you&amp;nbsp;&lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@BB156BE64F7B6DF6C334DBEE4A42A0C3/images/emoticons/1f62d.png" alt=":sob:" title=":sob:" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="gtx-trans-icon"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 02 Feb 2021 06:53:29 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/492728#M24629</guid>
      <dc:creator>Boneless</dc:creator>
      <dc:date>2021-02-02T06:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to get team root folder by SwiftyDropbox?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/492902#M24636</link>
      <description>&lt;P&gt;The "Error loading app info" can occur if you attempt to request scopes that are not enabled for your app. It sounds like your app does not have team scopes enabled, so you should not request them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should use&amp;nbsp;withPathRoot to access the team space though. Can you check that you are doing so, and that your&amp;nbsp;"xxxxxx" value is the root namespace ID for the team space? What error/output are you getting for that now?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 17:11:59 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/492902#M24636</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-02-02T17:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to get team root folder by SwiftyDropbox?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/493255#M24647</link>
      <description>&lt;P class="p1"&gt;Let focus on the first question “team scopes”&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;I&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;set a new app in App Console and create a simple test project for it.&lt;/P&gt;&lt;P class="p1"&gt;You can see the code here&lt;/P&gt;&lt;P class="p3"&gt;&lt;A href="https://github.com/hanpo/XenBoxTest" target="_blank"&gt;https://github.com/hanpo/XenBoxTest&lt;/A&gt;&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;You also can see my setting in App Console by images.&lt;/P&gt;&lt;P class="p1"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-02-03 at 10.06.29 PM.png" style="width: 999px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/20811i384A73777858519B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2021-02-03 at 10.06.29 PM.png" alt="Screen Shot 2021-02-03 at 10.06.29 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-02-03 at 10.06.40 PM.png" style="width: 999px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/20813i6C9D531B7D710DE8/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2021-02-03 at 10.06.40 PM.png" alt="Screen Shot 2021-02-03 at 10.06.40 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-02-03 at 10.06.49 PM.png" style="width: 999px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/20810iF6CB9FD6ECFECFB6/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2021-02-03 at 10.06.49 PM.png" alt="Screen Shot 2021-02-03 at 10.06.49 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P class="p1"&gt;If I use ScopeRequest(scopeType: .user, scopes: ["account_info.read"], includeGrantedScopes: false) or DropboxClientsManager.authorizeFromController, it will show "Error loading app info"&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;The test project may let you clearly point where I am doing wrong for authoriztion.&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 14:27:36 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/493255#M24647</guid>
      <dc:creator>Boneless</dc:creator>
      <dc:date>2021-02-03T14:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to get team root folder by SwiftyDropbox?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/493340#M24653</link>
      <description>&lt;P&gt;I see, thanks! That's helpful. I see in this sample project that you're &lt;A href="https://github.com/hanpo/XenBoxTest/blob/main/XenBoxTest/ViewController.swift#L71" target="_self"&gt;requesting a team scope&amp;nbsp;&lt;SPAN class="pl-pds"&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;team_info.read&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN class="pl-pds"&gt;&lt;A href="https://github.com/hanpo/XenBoxTest/blob/main/XenBoxTest/ViewController.swift#L71" target="_self"&gt;"&lt;/A&gt;, and it sounds like you have the official&amp;nbsp;Dropbox iOS app installed. When you have the official Dropbox mobile app installed, it will handle the app authorization flow (since the user is likely already signed in there anyway). Unfortunately, it looks like the authorization flow in the official mobile apps doesn't currently work with team scopes in particular though. (I'll bring this up with the team to see if we can get that working.)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="pl-pds"&gt;If you just want to list the contents of any folders (including team folders/spaces) in the user's account though, you don't actually need any team scopes. You just need 'files.metadata.read' (a user scope) to be able to access the metadata of any folder/space in the connected account.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, please just use the user scopes (such as 'files.metadata.read') and let me know what trouble, if any, you're still having with&amp;nbsp;listFolder/listFolderContinue. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 17:56:13 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/493340#M24653</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-02-03T17:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to get team root folder by SwiftyDropbox?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/493469#M24658</link>
      <description>&lt;P&gt;OK,&amp;nbsp;&lt;SPAN&gt;Team Scopes is all close and only open Individual Scopes.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-02-04 at 12.10.06 PM.png" style="width: 999px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/20825i867B380C7E92B7DF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2021-02-04 at 12.10.06 PM.png" alt="Screen Shot 2021-02-04 at 12.10.06 PM.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I modify code and commit it for getting team root folders and files.&lt;/P&gt;&lt;P&gt;You can see the code here&lt;BR /&gt;&lt;A href="https://github.com/hanpo/XenBoxTest" target="_blank" rel="nofollow noopener noreferrer"&gt;https://github.com/hanpo/XenBoxTest&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Operation is use method loginAction then call method listAction&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In method listAction&lt;/P&gt;&lt;PRE&gt;let clientWithPathRoot = DropboxClientsManager.authorizedClient?.withPathRoot(.namespaceId(rootNamespaceIdString ?? ""))

clientWithPathRoot?.files.listFolder(path: "" ,includeMountedFolders: true).response(completionHandler: {response, error in

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print("response:\(response),error:\(error) ")

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; })&lt;/PRE&gt;&lt;P class="p1"&gt;I think&amp;nbsp;clientWithPathRoot maybe not get correct object.&lt;/P&gt;&lt;P class="p1"&gt;So, when&amp;nbsp;listFolder will show error&lt;/P&gt;&lt;LI-SPOILER&gt;&lt;P class="p1"&gt;&lt;STRONG&gt;2021-02-04 12:08:26.656055+0800 XenBoxTest[2036:1742155] Task &amp;lt;845DD768-5EDB-4121-A43B-96302CBCE75F&amp;gt;.&amp;lt;1&amp;gt; load failed with error Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=&lt;A href="https://api.dropbox.com/2/files/list_folder" target="_blank" rel="noopener"&gt;https://api.dropbox.com/2/files/list_folder&lt;/A&gt;, NSErrorFailingURLKey=&lt;A href="https://api.dropbox.com/2/files/list_folder" target="_blank" rel="noopener"&gt;https://api.dropbox.com/2/files/list_folder&lt;/A&gt;, _NSURLErrorRelatedURLSessionTaskErrorKey=(&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;STRONG&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;"LocalDataTask &amp;lt;845DD768-5EDB-4121-A43B-96302CBCE75F&amp;gt;.&amp;lt;1&amp;gt;"&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;STRONG&gt;), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask &amp;lt;845DD768-5EDB-4121-A43B-96302CBCE75F&amp;gt;.&amp;lt;1&amp;gt;, NSLocalizedDescription=cancelled} [-999]&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;STRONG&gt;2021-02-04 12:08:26.666504+0800 XenBoxTest[2036:1742152] Task &amp;lt;845DD768-5EDB-4121-A43B-96302CBCE75F&amp;gt;.&amp;lt;1&amp;gt; finished with error - code: -999&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;STRONG&gt;2021-02-04 12:08:26.670393+0800 XenBoxTest[2036:1742153] Task &amp;lt;845DD768-5EDB-4121-A43B-96302CBCE75F&amp;gt;.&amp;lt;1&amp;gt; HTTP load failed (error code: -999 [1:89])&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;STRONG&gt;response:nil,error:Optional(Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=&lt;A href="https://api.dropbox.com/2/files/list_folder" target="_blank" rel="noopener"&gt;https://api.dropbox.com/2/files/list_folder&lt;/A&gt;, NSErrorFailingURLKey=&lt;A href="https://api.dropbox.com/2/files/list_folder" target="_blank" rel="noopener"&gt;https://api.dropbox.com/2/files/list_folder&lt;/A&gt;, _NSURLErrorRelatedURLSessionTaskErrorKey=(&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;STRONG&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;"LocalDataTask &amp;lt;845DD768-5EDB-4121-A43B-96302CBCE75F&amp;gt;.&amp;lt;1&amp;gt;"&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;STRONG&gt;), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask &amp;lt;845DD768-5EDB-4121-A43B-96302CBCE75F&amp;gt;.&amp;lt;1&amp;gt;, NSLocalizedDescription=cancelled})&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/LI-SPOILER&gt;&lt;P class="p1"&gt;Any suggestion? thank you&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="gtx-trans-icon"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 04 Feb 2021 04:21:44 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/493469#M24658</guid>
      <dc:creator>Boneless</dc:creator>
      <dc:date>2021-02-04T04:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to get team root folder by SwiftyDropbox?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/493818#M24666</link>
      <description>&lt;P&gt;This appears to be the same sort of error you were getting earlier, which I commented on in &lt;A href="https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/492902/highlight/true#M24636" target="_self"&gt;this reply&lt;/A&gt;. That is, it sounds like your&amp;nbsp;clientWithPathRoot variable is getting removed before the call can complete. You'll need to make sure you keep that defined for the lifetime of the call.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 22:05:28 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/493818#M24666</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-02-04T22:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to get team root folder by SwiftyDropbox?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/494231#M24685</link>
      <description>&lt;P&gt;I try many way to keep&amp;nbsp;&lt;SPAN&gt;client variable and&amp;nbsp;&lt;/SPAN&gt;set&amp;nbsp;withPathRoot, but still has error. Is the method "withPathRoot"&amp;nbsp;really work or it has bug?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="gtx-trans-icon"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 06 Feb 2021 00:51:04 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/494231#M24685</guid>
      <dc:creator>Boneless</dc:creator>
      <dc:date>2021-02-06T00:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to get team root folder by SwiftyDropbox?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/494735#M24690</link>
      <description>&lt;P&gt;Yes, the&amp;nbsp;withPathRoot method is the right way to access different roots. I just tried it and it is working for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you clarify what you mean when you say you tried many ways to keep the client variable? What did you use exactly?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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?`.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 16:31:22 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/494735#M24690</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-02-08T16:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to get team root folder by SwiftyDropbox?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/497127#M24748</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;We solved the problem of setting "withPathRoot" by&amp;nbsp;SwiftyDropbox.&lt;/P&gt;&lt;P&gt;For other people has the same problem, I&amp;nbsp;record what I do here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I set class variable as you said(Most important).&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var dropboxClient:DropboxClient?&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;login then do those things&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;        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)
                }
                
            })
        })&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 08:02:44 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-team-root-folder-by-SwiftyDropbox/m-p/497127#M24748</guid>
      <dc:creator>Boneless</dc:creator>
      <dc:date>2021-02-17T08:02:44Z</dc:date>
    </item>
  </channel>
</rss>

