<?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: Creating a folder in Dropbox in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-in-Dropbox/m-p/179156#M7234</link>
    <description>&lt;P&gt;Yes, API v2 offers structured exceptions, so you can detect specific scenarios like this. The documentation for &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.0.x/com/dropbox/core/v2/files/DbxUserFilesRequests.html#createFolder-java.lang.String-" target="_blank" rel="nofollow noreferrer"&gt;createFolder&lt;/A&gt; covers all of the types of exceptions it can throw.&lt;/P&gt;
&lt;P&gt;For example, to detect this particular error case:&lt;/P&gt;
&lt;PRE&gt;try {&lt;BR /&gt;    FolderMetadata folder = client.files().createFolder("/test_java_createFolder");&lt;BR /&gt;    System.out.println(folder.getName());&lt;BR /&gt;} catch (CreateFolderErrorException err) {&lt;BR /&gt;    if (err.errorValue.isPath() &amp;amp;&amp;amp; err.errorValue.getPathValue().isConflict()) {&lt;BR /&gt;        System.out.println("Something already exists at the path.");&lt;BR /&gt;    } else {&lt;BR /&gt;        System.out.print("Some other CreateFolderErrorException occurred...");&lt;BR /&gt;        System.out.print(err.toString());&lt;BR /&gt;    }&lt;BR /&gt;} catch (Exception err) {&lt;BR /&gt;    System.out.print("Some other Exception occurred...");&lt;BR /&gt;    System.out.print(err.toString());&lt;BR /&gt;}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jul 2016 03:54:50 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2016-07-27T03:54:50Z</dc:date>
    <item>
      <title>Creating a folder in Dropbox</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-in-Dropbox/m-p/179153#M7231</link>
      <description>&lt;P&gt;Is there a sample of creating a folder in Dropbox from the Android Java SDK for Core API v2?&amp;nbsp; The example of uploading files seems to deal only with the root folder.&amp;nbsp; I have a background task that has an instance of DbxUserFilesRequests.&amp;nbsp; I know that applying createFolder() to this instance will do it, but if the folder already exists, it throws an exception.&amp;nbsp; How can I find out if the folder exists before attempting to create it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:31:26 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-in-Dropbox/m-p/179153#M7231</guid>
      <dc:creator>Robert S.138</dc:creator>
      <dc:date>2019-05-29T09:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a folder in Dropbox</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-in-Dropbox/m-p/179154#M7232</link>
      <description>&lt;P&gt;Hi Robert, just trying to create the folder and catching the exception is a fine way to handle this. It's as efficient as possible too, since it just requires the one API call.&lt;/P&gt;
&lt;P&gt;If you do want to check ahead of time, you can use &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.0.x/com/dropbox/core/v2/files/DbxUserFilesRequests.html#getMetadata-java.lang.String-" target="_blank" rel="nofollow noreferrer"&gt;getMetadata&lt;/A&gt;. That will throw an exception if the folder doesn't exist though anyway, which you would need to catch.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 00:58:02 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-in-Dropbox/m-p/179154#M7232</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-07-27T00:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a folder in Dropbox</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-in-Dropbox/m-p/179155#M7233</link>
      <description>&lt;P&gt;Is there a specific exception I should check for on the createFolder?&amp;nbsp; I don't want to ignore an exception that is unrelated to the fact that the folder already exists.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 03:37:40 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-in-Dropbox/m-p/179155#M7233</guid>
      <dc:creator>Robert S.138</dc:creator>
      <dc:date>2016-07-27T03:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a folder in Dropbox</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-in-Dropbox/m-p/179156#M7234</link>
      <description>&lt;P&gt;Yes, API v2 offers structured exceptions, so you can detect specific scenarios like this. The documentation for &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.0.x/com/dropbox/core/v2/files/DbxUserFilesRequests.html#createFolder-java.lang.String-" target="_blank" rel="nofollow noreferrer"&gt;createFolder&lt;/A&gt; covers all of the types of exceptions it can throw.&lt;/P&gt;
&lt;P&gt;For example, to detect this particular error case:&lt;/P&gt;
&lt;PRE&gt;try {&lt;BR /&gt;    FolderMetadata folder = client.files().createFolder("/test_java_createFolder");&lt;BR /&gt;    System.out.println(folder.getName());&lt;BR /&gt;} catch (CreateFolderErrorException err) {&lt;BR /&gt;    if (err.errorValue.isPath() &amp;amp;&amp;amp; err.errorValue.getPathValue().isConflict()) {&lt;BR /&gt;        System.out.println("Something already exists at the path.");&lt;BR /&gt;    } else {&lt;BR /&gt;        System.out.print("Some other CreateFolderErrorException occurred...");&lt;BR /&gt;        System.out.print(err.toString());&lt;BR /&gt;    }&lt;BR /&gt;} catch (Exception err) {&lt;BR /&gt;    System.out.print("Some other Exception occurred...");&lt;BR /&gt;    System.out.print(err.toString());&lt;BR /&gt;}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 03:54:50 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Creating-a-folder-in-Dropbox/m-p/179156#M7234</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-07-27T03:54:50Z</dc:date>
    </item>
  </channel>
</rss>

