google-api-dotnet-client: Download fails in Drive.Sample

What steps will reproduce the problem?
1. Download the latest of GoogleApisSamples
2. Enable Drive API and configure ClientID and Client Secret
3. Run the Drive.Sample project after setting the UploadFileName and 
DownloadDirectoryName constants

What is the expected output? 
The file is uploaded to Google Drive
The file is downloaded from Google Drive
The file is removed from Google Drive

What do you see instead?
The file is uploaded to Google Drive
The program fails while attempting to download the file from Google Drive
The file is removed from Google Drive

What version of the product are you using? Hg clone from 8/23/2013
What is your operating system? Win 7 x64
What is your IDE? Visual Studio 2012
What is the .NET framework version? .NET Framework 4

Additional information:
The app uploads an image to Google Drive first. When it attempts the download 
it fails in the MediaDownloader.cs file, inside the DownloadCore method. This 
is after I have provided the ClientID and Client Secret.

When running it in the debugger. the response comes back as:
{StatusCode: 302, ReasonPhrase: 'Moved Temporarily'

We can see a bunch of redirects are taking place in the log file too and it 
reports Abnormal response at the end (query strings omitted for brevity):

013-08-23 16:19:18,950 [13] DEBUG Google.Apis.Http.ConfigurableMessageHandler 
(null) - Redirect response was handled successfully. Redirect to 
https://docs.google.com/a/...

2013-08-23 16:19:19,173 [13] DEBUG Google.Apis.Http.ConfigurableMessageHandler 
(null) - Redirect response was handled successfully. Redirect to 
https://doc-0s-1g-docs.googleusercontent.com/docs/securesc/...

2013-08-23 16:19:19,175 [13] DEBUG Google.Apis.Http.ConfigurableMessageHandler 
(null) - Abnormal response is being returned. Status Code is Redirect

A fix or suggestions/pointers on how to debug this kind of issue will be 
greatly appreciated.

Original issue reported on code.google.com by u...@ftitech.mygbiz.com on 23 Aug 2013 at 3:46

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 17

Most upvoted comments

Thanks for the update, Peleyal. Your changes look fine and we will get the 
latest. Returning to my second question, I didn't see anything in the code that 
indicates how you are specifically handling Google Docs that must be exported 
to some format, such as Doc or PDF prior to being downloaded. It appears that 
the only way to do that is to use the deprecated Google Docs API, as shown in 
the download code on this page: 
https://developers.google.com/google-apps/documents-list/#downloading_documents_
and_files. 

Original comment by ethanwil...@gmail.com on 19 Sep 2013 at 3:53