title: EWS. The request failed. The remote server returned an error: (401) Unauthorized on Mac OS only
body: <p>I need to connect to EWS. I am using Microsoft.Exchange.WebServices.NETStandard NuGet package for that. On the Windows machine everything is ok, but on Mac OS I'm getting the error &quot;The remote server returned an error: (401) Unauthorized.&quot; Also, if I use just Microsoft.Exchange.WebServices it works fine, but whole my project is based on .Net Core. Maybe, somebody has encountered this problem.</p>
  <pre><code>using System;
  using System.Linq;
  using Microsoft.Exchange.WebServices.Data;
  
  namespace testExchange
  {
      class Program
      {
          static void Main(string[] args)
          {
              var exchangeService = new ExchangeService(ExchangeVersion.Exchange2010_SP2, TimeZoneInfo.Utc);
              
              string userLogin = &quot;userLogin&quot;;
              string userPass = &quot;userPassword&quot;;
              string exchangeDomain = &quot;icx&quot;;
              string userEmail = &quot;userEmail@domain.com&quot;;
              string webmail = &quot;https://domain/ews/Exchange.asmx&quot;;
              exchangeService.Credentials = new WebCredentials(userLogin, userPass, exchangeDomain);
              exchangeService.Url = new Uri(webmail);
  
              string name = exchangeService.ResolveName(userEmail, ResolveNameSearchLocation.DirectoryOnly, true).Result.First().Contact.DisplayName;
  
              Console.WriteLine(name);
          }
      }
  }
  </code></pre>