<?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 Need .Net sample for download to file in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Need-Net-sample-for-download-to-file/m-p/250951#M14436</link>
    <description>&lt;P&gt;I'm using Dropbox API in an asp.net application. I have managed to download the file contents into a stream upto the following line of code in an async task.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var strm = response.GetContentAsStreamAsync();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I can't find a sample of how to write this stream finally to a file on the web server for which I do have a path DestPath. I have tried using some .Net code to write Stream to file but that complains and can not compile because the above strm and IO.Stream are different. I can't find a sample in .Net SDK for dropbox. Can someone help?&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 09:17:38 GMT</pubDate>
    <dc:creator>sanjayssk</dc:creator>
    <dc:date>2019-05-29T09:17:38Z</dc:date>
    <item>
      <title>Need .Net sample for download to file</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Need-Net-sample-for-download-to-file/m-p/250951#M14436</link>
      <description>&lt;P&gt;I'm using Dropbox API in an asp.net application. I have managed to download the file contents into a stream upto the following line of code in an async task.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var strm = response.GetContentAsStreamAsync();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I can't find a sample of how to write this stream finally to a file on the web server for which I do have a path DestPath. I have tried using some .Net code to write Stream to file but that complains and can not compile because the above strm and IO.Stream are different. I can't find a sample in .Net SDK for dropbox. Can someone help?&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:17:38 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Need-Net-sample-for-download-to-file/m-p/250951#M14436</guid>
      <dc:creator>sanjayssk</dc:creator>
      <dc:date>2019-05-29T09:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: Need .Net sample for download to file</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Need-Net-sample-for-download-to-file/m-p/250955#M14438</link>
      <description>&lt;P&gt;&lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Stone_IDownloadResponse_1_GetContentAsStreamAsync.htm" target="_self"&gt;The&amp;nbsp;GetContentAsStream method&lt;/A&gt; yields a &lt;A href="https://msdn.microsoft.com/en-us/library/8f86tw9e" target="_self"&gt;Stream&lt;/A&gt;, so you should be able to use &lt;A href="https://msdn.microsoft.com/en-us/library/dd782932" target="_self"&gt;CopyTo&lt;/A&gt; like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var strm = await response.GetContentAsStreamAsync();

using (var fileStream = File.Create(localFilePath))
{
    strm.CopyTo(fileStream);
}&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Nov 2017 16:39:25 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Need-Net-sample-for-download-to-file/m-p/250955#M14438</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-11-03T16:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: Need .Net sample for download to file</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Need-Net-sample-for-download-to-file/m-p/250960#M14439</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the speedy reply! I was missing the "await" and hence it was complaining that CopyTo is not a method of Task&amp;lt;Stream&amp;gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 16:48:32 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Need-Net-sample-for-download-to-file/m-p/250960#M14439</guid>
      <dc:creator>sanjayssk</dc:creator>
      <dc:date>2017-11-03T16:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Need .Net sample for download to file</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Need-Net-sample-for-download-to-file/m-p/251043#M14443</link>
      <description>&lt;P&gt;Any ideas how to catch a Timeout exception for large downloads? I tried using Try/Catch but it is not raised.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Update: I tried this code but it doesn't cause a timeout.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var expirationTimeTask = Task.Delay(TimeSpan.FromSeconds(30));
var strm = response.GetContentAsStreamAsync();
var finishedTask = await Task.WhenAny(expirationTimeTask, strm);
if (finishedTask == expirationTimeTask)
{
   //timeout error processing (does not get here)
}   &lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Nov 2017 03:26:44 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Need-Net-sample-for-download-to-file/m-p/251043#M14443</guid>
      <dc:creator>sanjayssk</dc:creator>
      <dc:date>2017-11-04T03:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: Need .Net sample for download to file</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Need-Net-sample-for-download-to-file/m-p/251161#M14449</link>
      <description>&lt;P&gt;Oops. On debugging, I found that it is stuck at CopyTo and that takes a long time and times out. So does the actual download occur on "CopyTo"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Update: Was above to solve this by studying the Asp.net samples on:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/aspnet/web-forms/overview/performance-and-caching/using-asynchronous-methods-in-aspnet-45#CreatingAsynchGizmos" target="_blank"&gt;https://docs.microsoft.com/en-us/aspnet/web-forms/overview/performance-and-caching/using-asynchronous-methods-in-aspnet-45#CreatingAsynchGizmos&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Nov 2017 18:07:58 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Need-Net-sample-for-download-to-file/m-p/251161#M14449</guid>
      <dc:creator>sanjayssk</dc:creator>
      <dc:date>2017-11-05T18:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Need .Net sample for download to file</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Need-Net-sample-for-download-to-file/m-p/326203#M19120</link>
      <description>&lt;P&gt;How to call it on windows/desktop application to download file.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 04:24:00 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Need-Net-sample-for-download-to-file/m-p/326203#M19120</guid>
      <dc:creator>yasirjaseem</dc:creator>
      <dc:date>2019-01-31T04:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Need .Net sample for download to file</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Need-Net-sample-for-download-to-file/m-p/326264#M19123</link>
      <description>&lt;P&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/961033"&gt;@yasirjaseem&lt;/a&gt;&amp;nbsp;We&amp;nbsp;recommend using &lt;A href="https://github.com/dropbox/dropbox-sdk-dotnet" target="_self"&gt;the official Dropbox .NET SDK&lt;/A&gt;. There's &lt;A href="https://github.com/dropbox/dropbox-sdk-dotnet/blob/master/dropbox-sdk-dotnet/Examples/SimpleTest/Program.cs#L403" target="_blank"&gt;an example of downloading files here&lt;/A&gt;. If something isn't working as expected for you, &lt;A href="https://www.dropboxforum.com/t5/forums/postpage/board-id/101000014" target="_self"&gt;open a new thread&lt;/A&gt; with details.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 15:36:53 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Need-Net-sample-for-download-to-file/m-p/326264#M19123</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-01-31T15:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need .Net sample for download to file</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Need-Net-sample-for-download-to-file/m-p/548324#M26104</link>
      <description>&lt;P&gt;i am tring to downlaod a maual but it will not work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Oct 2021 15:18:12 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Need-Net-sample-for-download-to-file/m-p/548324#M26104</guid>
      <dc:creator>kelly0318</dc:creator>
      <dc:date>2021-10-01T15:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Need .Net sample for download to file</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Need-Net-sample-for-download-to-file/m-p/548329#M26107</link>
      <description>&lt;P&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1478875"&gt;@kelly0318&lt;/a&gt; This is an old thread about writing code to download from Dropbox programmatically. If you need help using Dropbox itself you may want to open a thread in &lt;A href="https://www.dropboxforum.com/t5/Files-folders/ct-p/files-folders" target="_self"&gt;the 'Help from the Community &amp;gt; Files &amp;amp; folders' section&lt;/A&gt; or otherwise &lt;A href="https://www.dropbox.com/support/" target="_self"&gt;contact support&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Oct 2021 15:30:14 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Need-Net-sample-for-download-to-file/m-p/548329#M26107</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-10-01T15:30:14Z</dc:date>
    </item>
  </channel>
</rss>

