<?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 List content of Team forlders Within Python SDK in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/List-content-of-Team-forlders-Within-Python-SDK/m-p/372315#M20971</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I'm trying to list all the files contained in a dropbox business team folder.&lt;/P&gt;
&lt;P&gt;I'm using the official Python SDK.&lt;/P&gt;
&lt;P&gt;I tried to use the&amp;nbsp;dropbox.DropboxTeam class.&lt;/P&gt;
&lt;P&gt;Here is my code :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;dbx = dropbox.DropboxTeam("&amp;lt;TOKEN&amp;gt;");&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can list all the namespaces availables with :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;for entry in dbx.team_namespaces_list().namespaces:
    print(entry.namespace_id +" / "+entry.name)&lt;/PRE&gt;
&lt;P&gt;When i use the team_team_folder_list() :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;for entry in dbx.team_team_folder_list().team_folders:
    print(entry)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I retrieve the top-level folder which is the shared workspace.&lt;/P&gt;
&lt;P&gt;Then i want to list all the files and folder in this directory :&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;p = dropbox.common.PathRoot.namespace_id("&amp;lt;TEAM_FOLDER_ID&amp;gt;")
for entry in dbx.with_path_root(p).team_team_folder_list().team_folders:
    print(entry)&lt;/PRE&gt;
&lt;P&gt;I always get the error :&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Traceback (most recent call last):
  File "dropbox_hausfeld.py", line 40, in &amp;lt;module&amp;gt;
    for entry in dbx.with_path_root(p).team_team_folder_list().team_folders:
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dropbox/base_team.py", line 1808, in team_team_folder_list
    None,
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dropbox/dropbox.py", line 274, in request
    timeout=timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dropbox/dropbox.py", line 365, in request_json_string_with_retry
    timeout=timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dropbox/dropbox.py", line 456, in request_json_string
    raise BadInputError(request_id, r.text)
dropbox.exceptions.BadInputError: BadInputError('00f98974766854e558110eec5a014ed7', 'Error in call to API function "team/team_folder/list": Unexpected path root value in HTTP header "Dropbox-API-Path-Root": "{\\".tag\\": \\"namespace_id\\", \\"namespace_id\\": \\"&amp;lt;TEAM_FOLDER_ID&amp;gt;\\"}"')&lt;/PRE&gt;
&lt;P&gt;Is this the good way to do it ?&amp;nbsp;How can i solve the issue ?&lt;/P&gt;
&lt;P&gt;How can i access all the files in a team dropbox ?&lt;/P&gt;
&lt;P&gt;Thanks in advance for your help,&lt;/P&gt;
&lt;P&gt;Thomas.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 18 Oct 2019 15:35:03 GMT</pubDate>
    <dc:creator>trayer72</dc:creator>
    <dc:date>2019-10-18T15:35:03Z</dc:date>
    <item>
      <title>List content of Team forlders Within Python SDK</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/List-content-of-Team-forlders-Within-Python-SDK/m-p/372315#M20971</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I'm trying to list all the files contained in a dropbox business team folder.&lt;/P&gt;
&lt;P&gt;I'm using the official Python SDK.&lt;/P&gt;
&lt;P&gt;I tried to use the&amp;nbsp;dropbox.DropboxTeam class.&lt;/P&gt;
&lt;P&gt;Here is my code :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;dbx = dropbox.DropboxTeam("&amp;lt;TOKEN&amp;gt;");&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can list all the namespaces availables with :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;for entry in dbx.team_namespaces_list().namespaces:
    print(entry.namespace_id +" / "+entry.name)&lt;/PRE&gt;
&lt;P&gt;When i use the team_team_folder_list() :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;for entry in dbx.team_team_folder_list().team_folders:
    print(entry)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I retrieve the top-level folder which is the shared workspace.&lt;/P&gt;
&lt;P&gt;Then i want to list all the files and folder in this directory :&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;p = dropbox.common.PathRoot.namespace_id("&amp;lt;TEAM_FOLDER_ID&amp;gt;")
for entry in dbx.with_path_root(p).team_team_folder_list().team_folders:
    print(entry)&lt;/PRE&gt;
&lt;P&gt;I always get the error :&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Traceback (most recent call last):
  File "dropbox_hausfeld.py", line 40, in &amp;lt;module&amp;gt;
    for entry in dbx.with_path_root(p).team_team_folder_list().team_folders:
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dropbox/base_team.py", line 1808, in team_team_folder_list
    None,
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dropbox/dropbox.py", line 274, in request
    timeout=timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dropbox/dropbox.py", line 365, in request_json_string_with_retry
    timeout=timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dropbox/dropbox.py", line 456, in request_json_string
    raise BadInputError(request_id, r.text)
dropbox.exceptions.BadInputError: BadInputError('00f98974766854e558110eec5a014ed7', 'Error in call to API function "team/team_folder/list": Unexpected path root value in HTTP header "Dropbox-API-Path-Root": "{\\".tag\\": \\"namespace_id\\", \\"namespace_id\\": \\"&amp;lt;TEAM_FOLDER_ID&amp;gt;\\"}"')&lt;/PRE&gt;
&lt;P&gt;Is this the good way to do it ?&amp;nbsp;How can i solve the issue ?&lt;/P&gt;
&lt;P&gt;How can i access all the files in a team dropbox ?&lt;/P&gt;
&lt;P&gt;Thanks in advance for your help,&lt;/P&gt;
&lt;P&gt;Thomas.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2019 15:35:03 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/List-content-of-Team-forlders-Within-Python-SDK/m-p/372315#M20971</guid>
      <dc:creator>trayer72</dc:creator>
      <dc:date>2019-10-18T15:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: List content of Team forlders Within Python SDK</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/List-content-of-Team-forlders-Within-Python-SDK/m-p/372488#M20976</link>
      <description>&lt;P&gt;Setting a path root isn't required or expected when calling team-level endpoints such as&amp;nbsp;team_team_folder_list. It is only supported for user-level filesystem endpoints.&lt;/P&gt;
&lt;P&gt;Further,&amp;nbsp;team_team_folder_list is only for listing the team folders themselves. To list the contents of any particular folder, you should use&amp;nbsp;&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox.Dropbox.files_list_folder" target="_self"&gt;files_list_folder&lt;/A&gt; and&amp;nbsp;&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox.Dropbox.files_list_folder_continue" target="_self"&gt;files_list_folder_continue&lt;/A&gt; instead. Since you have a&amp;nbsp;Dropbox Business API access token, for a team, setting that up would look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;dbx_as_user = dropbox.DropboxTeam("&amp;lt;TOKEN&amp;gt;").with_path_root(p).as_user(member_id)
dbx_as_user.files_list_folder("")&lt;/PRE&gt;
&lt;P&gt;This uses &lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox.DropboxTeam.as_user" target="_self"&gt;as_user&lt;/A&gt; to set a particular user to operate as, returning a&amp;nbsp;&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox.Dropbox" target="_self"&gt;Dropbox&lt;/A&gt; object.&lt;/P&gt;
&lt;P&gt;You can first get the team member ID, for the member_id value in the sample above, from various places via a DropboxTeam object, such as&amp;nbsp;&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox.DropboxTeam.team_members_list" target="_self"&gt;team_members_list&lt;/A&gt;/&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox.DropboxTeam.team_members_list_continue" target="_self"&gt;team_members_list_continue&lt;/A&gt;, or&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox.DropboxTeam.team_members_get_info" target="_self"&gt;team_members_get_info&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can find more information on the path root and member file access features, respectively, in &lt;A href="https://www.dropbox.com/developers/reference/namespace-guide" target="_self"&gt;the Namespace Guide&lt;/A&gt; and&amp;nbsp;&lt;A href="https://www.dropbox.com/developers/documentation/http/teams#teams-member-file-access" target="_self"&gt;Member file access documentation&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2019 16:04:55 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/List-content-of-Team-forlders-Within-Python-SDK/m-p/372488#M20976</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-10-18T16:04:55Z</dc:date>
    </item>
  </channel>
</rss>

