title: Google Drive Api with Service Account C#
body: <p>I've programmed to my API has a service account in my application, it works fine, all connection, upload, download and delete stuff, but when I used to use User Service, all files goes to my personal drive, now it goes somewhere, I think it goes to Google Cloud Platform...
  The question is, I don't have any account over there, because you need to pay to use that, so, does anyone knows where all these files goes?</p>
  
  <p>Here the code I'm using to make a connection call</p>
  
  <pre><code>    public static DriveService Connection(string path, string username, string p12Path)
      {
  
          var certificate = new X509Certificate2(p12Path, "XXXXXXXX", X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable);
  
          ServiceAccountCredential credential = new ServiceAccountCredential(
              new ServiceAccountCredential.Initializer("g service account")
              {
                  Scopes = Scopes
              }.FromCertificate(certificate));
  
          DriveService service = new DriveService(new BaseClientService.Initializer()
          {
              HttpClientInitializer = credential,
              ApplicationName = ApplicationName
          });
  
          return service;
      }
  </code></pre>
  
  <hr>
  
  <p>And here the method I'm using to upload a file.</p>
  
  <pre><code>    [Authorize]
      public static Google.Apis.Drive.v3.Data.File Upload(DriveService service, string uploadFile, string name)
      {
  
          var body = new Google.Apis.Drive.v3.Data.File();
          body.Name = name;
          body.MimeType = GetMimeType(uploadFile);
  
          byte[] byteArray = System.IO.File.ReadAllBytes(uploadFile);
          System.IO.MemoryStream stream = new System.IO.MemoryStream(byteArray);
          FilesResource.CreateMediaUpload request = service.Files.Create(body, stream, GetMimeType(uploadFile));
          request.Upload();
          return request.ResponseBody;
      }
  </code></pre>
  
  <hr>
  
  <p>So, can anyone help me?</p>