We're using the code from this sample in the Outlook add-in documentation to download the attachments of a message from an ASP.NET Wep API application; however the call to service.GetAttachments(...) fails with this exception:
Microsoft.Exchange.WebServices.Data.ServiceRequestException
HResult=0x80131500
Message=The request failed. The remote server returned an error: (401) Unauthorized.
Source=Microsoft.Exchange.WebServices
StackTrace:
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(IEwsHttpWebRequest request)
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(IEwsHttpWebRequest& request)
at Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.InternalExecute()
at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute()
at Microsoft.Exchange.WebServices.Data.ExchangeService.GetAttachments(String[] attachmentIds, Nullable`1 bodyType, IEnumerable`1 additionalProperties)
Inner Exception 1:
WebException: The remote server returned an error: (401) Unauthorized.
This is an example of the request we're sending from the Outlook add-in:
We're using the code from this sample in the Outlook add-in documentation to download the attachments of a message from an ASP.NET Wep API application; however the call to
service.GetAttachments(...)
fails with this exception:This is an example of the request we're sending from the Outlook add-in:
It should be noted that we're using an unofficial build of the EWS Managed API from the Exchange.WebServices.Managed.Api NuGet package, but the official build from the Microsoft.Exchange.WebServices NuGet package exhibits the same issue.