<?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: Search for a folder in the portal in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/search-for-a-folder-in-the-portal/m-p/842158#M3564</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can user the folder property of a user. I've created an example, where I'm using my own user. I create a list with the titles of the folders, that I currently have in my content. If a folder with a given name is not found, it will be created&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;gis &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; GIS&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;portalURL&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; username&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; password&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

me &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;users&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;me
my_folders &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;me&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;folders&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

new_folder &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'my new folder'&lt;/SPAN&gt;

folder_list &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;i&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'title'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; my_folders&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; new_folder &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; folder_list&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;content&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;create_folder&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;new_folder&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, it is worth noting that&amp;nbsp;&lt;EM&gt;create_folder&lt;/EM&gt; does nothing, if the folder already exists.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html?arcgis.gis.ContentManager.create_folder#arcgis.gis.ContentManager.create_folder" title="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html?arcgis.gis.ContentManager.create_folder#arcgis.gis.ContentManager.create_folder" rel="nofollow noopener noreferrer" target="_blank"&gt;Link to api-reference&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 10:17:29 GMT</pubDate>
    <dc:creator>NikolajGrønholdt</dc:creator>
    <dc:date>2021-12-12T10:17:29Z</dc:date>
    <item>
      <title>Search for a folder in the portal</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/search-for-a-folder-in-the-portal/m-p/842157#M3563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to check if a folder exists in the portal before I create it. I don't see the feature_type = 'folder' option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance,&lt;/P&gt;&lt;P&gt;Marcelo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2020 02:52:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/search-for-a-folder-in-the-portal/m-p/842157#M3563</guid>
      <dc:creator>MarceloRosensaft</dc:creator>
      <dc:date>2020-06-11T02:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: Search for a folder in the portal</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/search-for-a-folder-in-the-portal/m-p/842158#M3564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can user the folder property of a user. I've created an example, where I'm using my own user. I create a list with the titles of the folders, that I currently have in my content. If a folder with a given name is not found, it will be created&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;gis &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; GIS&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;portalURL&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; username&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; password&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

me &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;users&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;me
my_folders &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;me&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;folders&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

new_folder &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'my new folder'&lt;/SPAN&gt;

folder_list &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;i&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'title'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; my_folders&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; new_folder &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; folder_list&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;content&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;create_folder&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;new_folder&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, it is worth noting that&amp;nbsp;&lt;EM&gt;create_folder&lt;/EM&gt; does nothing, if the folder already exists.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html?arcgis.gis.ContentManager.create_folder#arcgis.gis.ContentManager.create_folder" title="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html?arcgis.gis.ContentManager.create_folder#arcgis.gis.ContentManager.create_folder" rel="nofollow noopener noreferrer" target="_blank"&gt;Link to api-reference&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:17:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/search-for-a-folder-in-the-portal/m-p/842158#M3564</guid>
      <dc:creator>NikolajGrønholdt</dc:creator>
      <dc:date>2021-12-12T10:17:29Z</dc:date>
    </item>
  </channel>
</rss>

