<?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 folder exists and collect shared folder in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-folder-exists-and-collect-shared-folder/m-p/87859#M2711</link>
    <description>&lt;P&gt;Thank you again Steve , you are great . So my solution for the first question was something like this:&lt;/P&gt;
&lt;P&gt;private bool CheckIfCloudPathExists(string cloudPath)&lt;BR /&gt; {&lt;BR /&gt; Metadata metadata = new Metadata();&lt;BR /&gt; try&lt;BR /&gt; {&lt;BR /&gt; System.Threading.Tasks.Task&amp;lt;Metadata&amp;gt; taskUpload = Task.Run(() =&amp;gt; GetFolderMetadata(cloudPath));&lt;BR /&gt; if (taskUpload.Result != null)&lt;BR /&gt; metadata = taskUpload.Result;&lt;BR /&gt; }&lt;BR /&gt; catch (AggregateException e)&lt;BR /&gt; {&lt;BR /&gt; if (e != null &amp;amp;&amp;amp; e.InnerException != null &amp;amp;&amp;amp; e.InnerException is ApiException&amp;lt;GetMetadataError&amp;gt;)&lt;BR /&gt; {&lt;BR /&gt; GetMetadataError err = (e.InnerException as ApiException&amp;lt;GetMetadataError&amp;gt;).ErrorResponse;&lt;BR /&gt; if (err.IsNotFound || err.IsOther)&lt;BR /&gt; return false;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; return metadata != null;&lt;BR /&gt; }&lt;/P&gt;
&lt;P&gt;I will reformulate the second question : Is it possible to set permisions to a file like this :&lt;/P&gt;
&lt;P&gt;File cloudFile = GetCloudFile(CloudPath); //here I'm getting my file ,and then I set it's permissions&lt;BR /&gt; if (cloudFile == null)&lt;BR /&gt; return false;&lt;/P&gt;
&lt;P&gt;Permission newPermission = new Permission();&lt;BR /&gt; newPermission.Value = UserEmail;&lt;BR /&gt; newPermission.Type = "user";&lt;/P&gt;
&lt;P&gt;if ( PermissionType == 1 )&lt;BR /&gt; newPermission.Role = "reader";&lt;BR /&gt; else if (PermissionType == 2)&lt;BR /&gt; newPermission.Role = "writer";&lt;BR /&gt; &lt;BR /&gt; try&lt;BR /&gt; {&lt;BR /&gt; PermissionsResource.InsertRequest insertRequest = GoogleDriveService.Permissions.Insert(newPermission, cloudFile.Id);&lt;/P&gt;
&lt;P&gt;if (NotifyUserByEmail == false &amp;amp;&amp;amp; UserEmail.EndsWith("@google.com"))&lt;BR /&gt; insertRequest.SendNotificationEmails = true;&lt;BR /&gt; else&lt;BR /&gt; insertRequest.SendNotificationEmails = NotifyUserByEmail;&lt;/P&gt;
&lt;P&gt;if (!string.IsNullOrEmpty(OptionalEmailMessage))&lt;BR /&gt; insertRequest.EmailMessage = OptionalEmailMessage;&lt;/P&gt;
&lt;P&gt;var retVal = insertRequest.Execute();&lt;BR /&gt; }&lt;/P&gt;
&lt;P&gt;This example is made on google api . When I want to share a file , I set it's permissions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Sep 2015 22:04:49 GMT</pubDate>
    <dc:creator>Nenciu D.</dc:creator>
    <dc:date>2015-09-02T22:04:49Z</dc:date>
    <item>
      <title>Check if folder exists and collect shared folder</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-folder-exists-and-collect-shared-folder/m-p/87857#M2709</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;1.I'm trying to check if folder exist in my dropbox by retrieving metadata from given path: (example path "/myfolder")&lt;/P&gt;
&lt;P&gt;public async Task&amp;lt;Metadata&amp;gt; GetFolderMetadata(string folderPath)&lt;BR /&gt; {&lt;BR /&gt; Metadata folderMetadata = await client.Files.GetMetadataAsync(folderPath);&lt;BR /&gt; if (folderMetadata != null)&lt;BR /&gt; return folderMetadata;&lt;/P&gt;
&lt;P&gt;return null;&lt;BR /&gt; }&lt;/P&gt;
&lt;P&gt;This is my method ,but if path doesn't exist , my application crashes without any error message.&lt;/P&gt;
&lt;P&gt;2.Also I want to collect all shared folders and then to retrieve the users(their emails only) that are sharing that folders.&lt;/P&gt;
&lt;P&gt;I'm using sdk v2 for C#.&lt;/P&gt;
&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:40:19 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-folder-exists-and-collect-shared-folder/m-p/87857#M2709</guid>
      <dc:creator>Nenciu D.</dc:creator>
      <dc:date>2019-05-29T09:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: Check if folder exists and collect shared folder</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-folder-exists-and-collect-shared-folder/m-p/87858#M2710</link>
      <description>&lt;P&gt;I believe you'll need to wrap the call in a try/catch so you can handle the exception when the path doesn't exist.&lt;/P&gt;
&lt;P&gt;For your second question, this isn't possible in the API today. (The email addresses of members of a shared folder are not exposed.)&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2015 12:11:52 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-folder-exists-and-collect-shared-folder/m-p/87858#M2710</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2015-09-02T12:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: Check if folder exists and collect shared folder</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-folder-exists-and-collect-shared-folder/m-p/87859#M2711</link>
      <description>&lt;P&gt;Thank you again Steve , you are great . So my solution for the first question was something like this:&lt;/P&gt;
&lt;P&gt;private bool CheckIfCloudPathExists(string cloudPath)&lt;BR /&gt; {&lt;BR /&gt; Metadata metadata = new Metadata();&lt;BR /&gt; try&lt;BR /&gt; {&lt;BR /&gt; System.Threading.Tasks.Task&amp;lt;Metadata&amp;gt; taskUpload = Task.Run(() =&amp;gt; GetFolderMetadata(cloudPath));&lt;BR /&gt; if (taskUpload.Result != null)&lt;BR /&gt; metadata = taskUpload.Result;&lt;BR /&gt; }&lt;BR /&gt; catch (AggregateException e)&lt;BR /&gt; {&lt;BR /&gt; if (e != null &amp;amp;&amp;amp; e.InnerException != null &amp;amp;&amp;amp; e.InnerException is ApiException&amp;lt;GetMetadataError&amp;gt;)&lt;BR /&gt; {&lt;BR /&gt; GetMetadataError err = (e.InnerException as ApiException&amp;lt;GetMetadataError&amp;gt;).ErrorResponse;&lt;BR /&gt; if (err.IsNotFound || err.IsOther)&lt;BR /&gt; return false;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; return metadata != null;&lt;BR /&gt; }&lt;/P&gt;
&lt;P&gt;I will reformulate the second question : Is it possible to set permisions to a file like this :&lt;/P&gt;
&lt;P&gt;File cloudFile = GetCloudFile(CloudPath); //here I'm getting my file ,and then I set it's permissions&lt;BR /&gt; if (cloudFile == null)&lt;BR /&gt; return false;&lt;/P&gt;
&lt;P&gt;Permission newPermission = new Permission();&lt;BR /&gt; newPermission.Value = UserEmail;&lt;BR /&gt; newPermission.Type = "user";&lt;/P&gt;
&lt;P&gt;if ( PermissionType == 1 )&lt;BR /&gt; newPermission.Role = "reader";&lt;BR /&gt; else if (PermissionType == 2)&lt;BR /&gt; newPermission.Role = "writer";&lt;BR /&gt; &lt;BR /&gt; try&lt;BR /&gt; {&lt;BR /&gt; PermissionsResource.InsertRequest insertRequest = GoogleDriveService.Permissions.Insert(newPermission, cloudFile.Id);&lt;/P&gt;
&lt;P&gt;if (NotifyUserByEmail == false &amp;amp;&amp;amp; UserEmail.EndsWith("@google.com"))&lt;BR /&gt; insertRequest.SendNotificationEmails = true;&lt;BR /&gt; else&lt;BR /&gt; insertRequest.SendNotificationEmails = NotifyUserByEmail;&lt;/P&gt;
&lt;P&gt;if (!string.IsNullOrEmpty(OptionalEmailMessage))&lt;BR /&gt; insertRequest.EmailMessage = OptionalEmailMessage;&lt;/P&gt;
&lt;P&gt;var retVal = insertRequest.Execute();&lt;BR /&gt; }&lt;/P&gt;
&lt;P&gt;This example is made on google api . When I want to share a file , I set it's permissions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2015 22:04:49 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-folder-exists-and-collect-shared-folder/m-p/87859#M2711</guid>
      <dc:creator>Nenciu D.</dc:creator>
      <dc:date>2015-09-02T22:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: Check if folder exists and collect shared folder</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-folder-exists-and-collect-shared-folder/m-p/87860#M2712</link>
      <description>&lt;P&gt;Dropbox doesn't have a permission model that looks like that. In Dropbox, you can create a share link for a file or folder (which can then be used by anyone who has that URL&amp;nbsp;to read the contents of the file or folder), or you can share a folder (which gives specific users access to that folder in their own Dropbox).&lt;/P&gt;
&lt;P&gt;Currently, the API only supports share links. So you can get a link for a file and then&amp;nbsp;send that link to people you want to grant (read-only) access to.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2015 00:21:16 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-folder-exists-and-collect-shared-folder/m-p/87860#M2712</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2015-09-03T00:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: Check if folder exists and collect shared folder</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-folder-exists-and-collect-shared-folder/m-p/87861#M2713</link>
      <description>&lt;P&gt;The Share Folder&amp;nbsp;button method or Send link method for a file are implemented? Because I want to at least send a notification through email .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2015 14:53:05 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-folder-exists-and-collect-shared-folder/m-p/87861#M2713</guid>
      <dc:creator>Nenciu D.</dc:creator>
      <dc:date>2015-09-03T14:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: Check if folder exists and collect shared folder</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-folder-exists-and-collect-shared-folder/m-p/87862#M2714</link>
      <description>&lt;P&gt;The SDK enables you to get a shared link for a file or folder, e.g., using &lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Sharing_Routes_SharingRoutes_CreateSharedLinkAsync.htm" target="_blank" rel="nofollow noreferrer"&gt;CreateSharedLinkAsync&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;It doesn't currently offer the ability to create shared folders though, as Steve mentioned.&lt;/P&gt;
&lt;P&gt;In any case, it's not currently possible to make&amp;nbsp;Dropbox send an&amp;nbsp;email about it for you via the API,&amp;nbsp;but I'll be sure to pass this along as a feature request.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2015 01:32:19 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-folder-exists-and-collect-shared-folder/m-p/87862#M2714</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2015-09-04T01:32:19Z</dc:date>
    </item>
  </channel>
</rss>

