Getting request.ResponseBody = null when trying to upload to my drive. I'm seeign the following exception 'Value cannot be null.Parameter name: baseUri'
here's the code
Google.Apis.Drive.v2.Data.File body = new Google.Apis.Drive.v2.Data.File();
body.Title = System.IO.Path.GetFileName(uploadFile);
body.Description = "File uploaded";
body.MimeType = GetMimeType(uploadFile);
body.Editable = true;
body.Shared = false;
body.Parents = new List<ParentReference>() { new ParentReference() { Id = parentID } };
var x = service.HttpClient.GetByteArrayAsync(uploadFile);
byte[] arrBytes = x.Result;
System.IO.MemoryStream stream = new System.IO.MemoryStream(arrBytes);
try
{
if (arrBytes.Length > 0)
{
FilesResource.InsertMediaUpload request = service.Files.Insert(body, stream, GetMimeType(uploadFile));
request.Convert = true;
request.Upload();
return request.ResponseBody;
}
else
{
Console.WriteLine("File does not exist: " + uploadFile);
return null;
}
}
catch (Exception e)
{
Console.WriteLine("An error occurred: " + e.Message);
return null;
}
any ideas on what I'm missing ?
EDIT
The file uploads to the drive now , I removed any Referrers in the API section. but the response is still null