title: Null response creating file using Google Drive .NET API
body: <p>I am trying to upload a file onto my Drive using Google Drive .NET API v3. My code is below</p>
  
  <pre><code>static string[] Scopes = { DriveService.Scope.Drive,
                         DriveService.Scope.DriveAppdata,
                         DriveService.Scope.DriveFile,
                         DriveService.Scope.DriveMetadataReadonly,
                         DriveService.Scope.DriveReadonly,
                         DriveService.Scope.DriveScripts };
      static string ApplicationName = "Drive API .NET Quickstart";
  
      public ActionResult Index()
      {
          UserCredential credential;
  
          using (var stream =
              new FileStream("C:/Users/admin1/Documents/visual studio 2017/Projects/TryGoogleDrive/TryGoogleDrive/client_secret.json", FileMode.Open, FileAccess.Read))
          {
              string credPath = Environment.GetFolderPath(
                  System.Environment.SpecialFolder.Personal);
              credPath = Path.Combine(credPath, ".credentials/drive-dotnet-quickstart.json");
  
              credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                  GoogleClientSecrets.Load(stream).Secrets,
                  Scopes,
                  "user",
                  CancellationToken.None,
                  new FileDataStore(credPath, true)).Result;
              Debug.WriteLine("Credential file saved to: " + credPath);
          }
  
          // Create Drive API service.
          var service = new DriveService(new BaseClientService.Initializer()
          {
              HttpClientInitializer = credential,
              ApplicationName = ApplicationName,
          });
  
          // Define parameters of request.
          FilesResource.ListRequest listRequest = service.Files.List();
          listRequest.PageSize = 10;
          listRequest.Fields = "nextPageToken, files(id, name)";
  
          // List files.
          IList&lt;Google.Apis.Drive.v3.Data.File&gt; files = listRequest.Execute()
              .Files;
          Debug.WriteLine("Files:");
          if (files != null &amp;&amp; files.Count &gt; 0)
          {
              foreach (var file in files)
              {
                  Debug.WriteLine("{0} ({1})", file.Name, file.Id);
              }
          }
          else
          {
              Debug.WriteLine("No files found.");
          }
  
          var fileMetadata = new Google.Apis.Drive.v3.Data.File()
          {
              Name = "report.csv",
              MimeType = "text/csv",
          };
          FilesResource.CreateMediaUpload request;
          using (var stream = new FileStream("C:/debugging/report.csv",
                                  FileMode.Open))
          {
              request = service.Files.Create(
                  fileMetadata, stream, "text/csv");
              request.Fields = "id";
              request.Upload();
          }
          var response = request.ResponseBody;
          Console.WriteLine("File ID: " + response.Id);
  
          return View();        
      }
  </code></pre>
  
  <p>The problem I'm facing is that response is always null. I looked into it a bit further and found that the request returned a 403 resultCode. I also took a look at some other questions on SO <a href="https://stackoverflow.com/questions/39468798/google-drive-api-v3-response-null">this</a> and <a href="https://stackoverflow.com/questions/19021931/google-drive-api-v2-insertmediaupload-null-response-received?rq=1">this</a> but neither were of any help.</p>
  
  <p>Edit: I forgot to mention that the first part of the code is working correctly - it lists all the files in my Drive. Only the second part is not working (the upload file part)</p>