title: The request failed. The remote server returned an error: (401) Unauthorized
body: <p>Am using EWS in order to access to the inbox of an email account. But I keep getting this error: </p>
  
  <blockquote>
    <p>The request failed. The remote server returned an error: (401) Unauthorized.</p>
  </blockquote>
  
  <pre><code>ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
  service.Credentials = new WebCredentials("account@company.net","password","domain");
  service.Url = new Uri("https://webpage.net/EWS/exchange.asmx");
  //SearchFilter searchFilter = new  SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, true));
  ItemView view = new ItemView(10);
  FindItemsResults&lt;Item&gt; findResults = service.FindItems(WellKnownFolderName.Inbox,view);//i get the error in this line of code
  
  foreach (Item item in findResults.Items)
  {
      Console.WriteLine(item.Subject);
  }
  </code></pre>