<?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: Check if user has access to any shared folders in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-user-has-access-to-any-shared-folders/m-p/619535#M28531</link>
    <description>&lt;P&gt;Yes, team folders are considered a type of shared folder, so just building on the previous sample, you can do something like this:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;team_folder_count = len([shared_folder for shared_folder in shared_folders if shared_folder.is_team_folder])
if team_folder_count == 0:
    print('User has no team folders')
else: 
    print('User has at least one team folder')
    print('User has %s team folder(s)' % team_folder_count)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note though that this will only catch "team folders", not "team spaces". Any Dropbox Business team may be using one of those two different configurations. Check out &lt;A href="https://developers.dropbox.com/dbx-team-files-guide" target="_blank"&gt;the Team Files Guide&lt;/A&gt; for information on that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 31 Aug 2022 16:46:01 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2022-08-31T16:46:01Z</dc:date>
    <item>
      <title>Check if user has access to any shared folders</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-user-has-access-to-any-shared-folders/m-p/619459#M28527</link>
      <description>&lt;P&gt;Hi, I'm trying to check if a user has access to any folders. My code at the moment is printing 'User has at least one shared folder' for everyone, but I'm not sure if that's correct. Could someone point me in the right direction please? I'm using Python, and this is my code:&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;dbx = dropbox.DropboxTeam(oauth2_refresh_token=REFRESH_TOKEN, app_key=APP_KEY, app_secret=APP_SECRET).as_user(team_member_id)
            
                shared_folders = dbx.sharing_list_folders(limit=1)
                if shared_folders == None:
                    print('User has no shared folders')
                else: 
                    print('User has at least one shared folder')&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 09:51:06 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-user-has-access-to-any-shared-folders/m-p/619459#M28527</guid>
      <dc:creator>JuliaNowicka</dc:creator>
      <dc:date>2022-09-06T09:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: Check if user has access to any shared folders</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-user-has-access-to-any-shared-folders/m-p/619464#M28528</link>
      <description>&lt;P&gt;[Cross-linking for reference: &lt;A href="https://stackoverflow.com/questions/73558139/check-if-a-user-has-access-to-any-shared-folders-in-dropbox" target="_blank"&gt;https://stackoverflow.com/questions/73558139/check-if-a-user-has-access-to-any-shared-folders-in-dropbox&lt;/A&gt; ]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, for the Python SDK, using the &lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox_client.Dropbox.sharing_list_folders" target="_blank" rel="noopener"&gt;sharing_list_folders&lt;/A&gt;/&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox_client.Dropbox.sharing_list_folders_continue" target="_blank" rel="noopener"&gt;sharing_list_folders_continue&lt;/A&gt; methods is the right way to list the shared folders that a user account has access to. The Dropbox API doesn't offer a call just for returning a boolean indicating whether or not an account has any shared folders, so listing and counting them would be the right solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note however that the &lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox_client.Dropbox.sharing_list_folders" target="_blank" rel="noopener"&gt;sharing_list_folders&lt;/A&gt; method returns a &lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/sharing.html#dropbox.sharing.ListFoldersResult" target="_blank" rel="noopener"&gt;ListFoldersResult&lt;/A&gt;, which is not itself the list of shared folders for that result page. That would be in ListFoldersResult.entries. So, you would instead need to do something like `if len(shared_folders.entries) == 0:` instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also while the `limit` parameter sets a maximum page size, it doesn't technically guarantee a minimum page size, so to be safe it would be best to implement the pagination as documented and check the whole list, like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;shared_folders = []
shared_folders_res = dbx.sharing_list_folders()
shared_folders += shared_folders_res.entries
while shared_folders_res.cursor:
    shared_folders_res = dbx.sharing_list_folders_continue(cursor=shared_folders_res.cursor)
    shared_folders += shared_folders_res.entries

if len(shared_folders) == 0:
    print('User has no shared folders')
else: 
    print('User has at least one shared folder')&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 15:17:58 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-user-has-access-to-any-shared-folders/m-p/619464#M28528</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-08-31T15:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Check if user has access to any shared folders</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-user-has-access-to-any-shared-folders/m-p/619479#M28529</link>
      <description>&lt;P&gt;Thank you so much Greg! Exactly what I was looking for! Can I do something similar to check team folders?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 15:36:46 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-user-has-access-to-any-shared-folders/m-p/619479#M28529</guid>
      <dc:creator>JuliaNowicka</dc:creator>
      <dc:date>2022-08-31T15:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Check if user has access to any shared folders</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-user-has-access-to-any-shared-folders/m-p/619535#M28531</link>
      <description>&lt;P&gt;Yes, team folders are considered a type of shared folder, so just building on the previous sample, you can do something like this:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;team_folder_count = len([shared_folder for shared_folder in shared_folders if shared_folder.is_team_folder])
if team_folder_count == 0:
    print('User has no team folders')
else: 
    print('User has at least one team folder')
    print('User has %s team folder(s)' % team_folder_count)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note though that this will only catch "team folders", not "team spaces". Any Dropbox Business team may be using one of those two different configurations. Check out &lt;A href="https://developers.dropbox.com/dbx-team-files-guide" target="_blank"&gt;the Team Files Guide&lt;/A&gt; for information on that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 16:46:01 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-user-has-access-to-any-shared-folders/m-p/619535#M28531</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-08-31T16:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: Check if user has access to any shared folders</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-user-has-access-to-any-shared-folders/m-p/619944#M28548</link>
      <description>&lt;P&gt;Thank you Greg, I will try that.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 09:12:43 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-user-has-access-to-any-shared-folders/m-p/619944#M28548</guid>
      <dc:creator>JuliaNowicka</dc:creator>
      <dc:date>2022-09-02T09:12:43Z</dc:date>
    </item>
  </channel>
</rss>

