title: Could not load file or assembly 'Google.Apis, Version=1.27.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab' or one of its dependencies.
body: <p>I have a requirement to implement gmail into my web application. While implementing Gmail in my web application, I am getting the mentioned exception.</p>
  
  <p>I have tried the steps mentioned in Gmail API Quickstart...
  <a href="https://developers.google.com/gmail/api/quickstart/dotnet" rel="nofollow noreferrer">https://developers.google.com/gmail/api/quickstart/dotnet</a></p>
  
  <p>As I am trying to create an object of GmailService, I am getting an exception. My code is as follows...</p>
  
  <pre><code>    static UserCredential GetGmailUserCredential()
      {
          UserCredential credential;
          string[] scopes = { GmailService.Scope.GmailReadonly };
          string credPath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), ".credentials/gmail-dotnet-quickstart.json");
          try
          {
              using (var stream = new System.IO.FileStream(@"D:\Projects_Temp\Learning\Webform\GSuite\client_secret.json", System.IO.FileMode.Open, System.IO.FileAccess.Read))
              {
                  credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                      GoogleClientSecrets.Load(stream).Secrets,
                      scopes,
                      Environment.UserName,
                      CancellationToken.None,
                      new FileDataStore(credPath, true)).Result;
              }
          }
          catch (Exception ex)
          {
              credential = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets { ClientId = clientID, ClientSecret = clientSecret }
                                                                                           , scopes
                                                                                           , Environment.UserName
                                                                                           , CancellationToken.None
                                                                                           , new FileDataStore(credPath, true)).Result;
          }
  
          return credential;
      }
  
      public static GmailService GetGmailClient()
      {
          var credential = GetGmailUserCredential();
          // Create Drive API service.
          var service = new GmailService(new BaseClientService.Initializer()
          {
              HttpClientInitializer = credential
          });
  
          return service;
      }
  
      public static List&lt;Label&gt; GetLabels(GmailService service)
      {
          // Define parameters of request.
          UsersResource.LabelsResource.ListRequest request = service.Users.Labels.List("me");
          // List labels.
          return request.Execute().Labels.ToList();
      }
  
  protected void Page_Load(object sender, EventArgs e)
      {
          if (!IsPostBack)
          {
              using (GmailService service = GSuiteHelper.GetGmailClient())
              {
                  var lst = GSuiteHelper.GetLabels(service);
              }
          }
      }
  </code></pre>