Google Drive: getting content of (an existing) file results in 404 response error

sharewarez

New Member
i have a file in my drive that has a "public" visibility. im using the code (below) from the examples page for the drive api to retreive the files content. the file meta data shows me that my file is there. but the hhtp response tells me its not there (The remote server returned an error: (404) Not Found.). any thoughts?\[code\] public static System.IO.Stream DownloadFile( IAuthenticator authenticator, Google.Apis.Drive.v2.Data.File file) { if (!String.IsNullOrEmpty(file.DownloadUrl)) { try { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(file.DownloadUrl)); authenticator.ApplyAuthenticationToRequest(request); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); if (response.StatusCode == HttpStatusCode.OK) { return response.GetResponseStream(); } else { Console.WriteLine( "An error occurred: " + response.StatusDescription); return null; } } catch (Exception e) { Console.WriteLine("An error occurred: " + e.Message); return null; } } else { // The file doesn't have any content stored on Drive. return null; } }\[/code\]
 
Back
Top