I seem to be unable to retrieve the content of a file via the google drive SDK. To reproduce the problem I use the API explorer to get the meta data for a small text file:
OK I finally worked it out. It seems for the GET request on the downloadURL you need to send the access token in the headers i.e send a "Authorization: Bearer {your access token}" header. DO NOT send the access token as part of the query string. Every other API call I have used in the Drive SDK is fine with the access token as part of the query string - except this one.
Try to use below code for request
var service1=SetCredential();
var AccessToken=((Google.Apis.Auth.OAuth2.UserCredential)service1.HttpClientInitializer).Token.AccessToken;
String link = "https://www.googleapis.com/drive/v2/files/" + fileId ;
HttpWebRequest request = WebRequest.Create(link) as HttpWebRequest;
request.Method = "GET";
request.Headers.Add("Authorization", "Bearer " + AccessToken);
WebResponse response = request.GetResponse();