SOAP header Action was not understood

Hi,

We are getting “SOAP header Action was not understood” error on IEWSClient.ListMessages function when calling any outlook.office365.com mailboxes. Sample code below:

NetworkCredential credentials = new NetworkCredential();

credentials.UserName = Options.MailProcessDefinition.UserName;

credentials.Password = Options.Password;

credentials.Domain = Options.MailProcessDefinition.Domain;

IEWSClient client = EWSClient.GetEWSClient(“[https://outlook.office365.com/ews/Exchange.asmx ](https://outlook.office365.com/ews/Exchange.asmx)”, credentials);

client.ListMessages(mailBoxFolderUri, numberOfMessages);

Error appears quite often but not constantly. Is this a known issue? if so is there a workaround?

We are using Aspose.Email 17.4.0.0

Thanks.

Hi Henrik,

We regret any inconvenience caused to you.

We have tested connectivity to Office365 account and listing messages functionality with the latest version of the API i.e. Aspose.Email for .NET 17.5 and were not able to face any such problem. Could you please give it a try using the latest version of the API and let us know your feedback? Following test account and sample code was used by us for testing this issue at our end.

Sample Code

IEWSClient client = EWSClient.GetEWSClient(“[https://outlook.office365.com/ews/exchange.asmx ](https://outlook.office365.com/ews/exchange.asmx)”, username, “Aspose1234”);

client.ListMessages(client.MailboxInfo.InboxUri, 3);

I am facing this same issue currently. This was working till some days back correctly. Now it is giving error whenever I execute the line:

var client = EWSClient.GetEWSClient(“https://outlook.office365.com/EWS/Exchange.asmx”, serviceId, servicePassword, domainId);

Error Details:
2019-08-05 07:36:46,668 [10] ERROR - Getting error while retrieving mail details from GetEmails method.
System.Web.Services.Protocols.SoapHeaderException: SOAP header Action was not understood.
at System.Web.Services.Protocols.SoapHeaderHandling.SetHeaderMembers(SoapHeaderCollection headers, Object target, SoapHeaderMapping[] mappings, SoapHeaderDirection direction, Boolean client)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at #=zQ6x2gZKDdkg2KO_xlBukqO4WBSnEMMYQuAyAc8IugWy0rJi0Uw==.GetFolder(GetFolderType GetFolder1)
at Aspose.Email.Clients.Exchange.WebService.EWSClient.GetEWSClient(String mailboxUri, ICredentials credentials, WebProxy proxy)
at Aspose.Email.Clients.Exchange.WebService.EWSClient.GetEWSClient(String mailboxUri, String username, String password, String domain)
at …

@sin2akshay,

I have observed the issue shared by you and request you to please first try using Aspose.Email for .NET 19.7 on your end. If there is still an issue then please provide the sample project along with test account access reproducing the issue so that we may investigate that further to help you out.

I am also recently facing this issue when calling IEWSClient.DeleteMessages(...).
We are using Aspose.Email for .NET 20.5

Sample code

var credentials = new NetworkCredential(UserName, Password, Domain);
IEWSClient client = EWSClient.GetEWSClient(MailBoxUri, credentials);
ExchangeMessageInfoCollection msg_list = client.ListMessages("folder_uri");
client.DeleteMessages(msg_list);

Exception Message: "SOAP header Action was not understood."
Exception Stack Trace:

   at System.Web.Services.Protocols.SoapHeaderHandling.SetHeaderMembers(SoapHeaderCollection headers, Object target, SoapHeaderMapping[] mappings, SoapHeaderDirection direction, Boolean client)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at #=z$8wL9KHwbigHAkJ0WoVe8hb7AWOb7H9RwHh0FUrB0_dIiimdQg==.DeleteItem(DeleteItemType DeleteItem1)
   at #=zRbDOjPTypUd0NzyNY51gHmcok2of40H6D3C7hHdsrd$1.DeleteItems(IEnumerable`1 #=zkVx9ttQ=, DeletionOptions #=ziaLhKc8=)
   at #=zRbDOjPTypUd0NzyNY51gHmcok2of40H6D3C7hHdsrd$1.DeleteMessages(ExchangeMessageInfoCollection #=zzSveBBw=, Boolean #=zfGYii3NB4zF1)
   at #=zRbDOjPTypUd0NzyNY51gHmcok2of40H6D3C7hHdsrd$1.DeleteMessages(ExchangeMessageInfoCollection #=zzSveBBw=)

@mt1,

I have observed the stack trace shared by you and request you to please provide test account credentials that is reproducing issue on your end and that we may use to verify the same on our end.

Thanks for the prompt reply.
I have concluded that the error was due to the amount of messages trying to be deleted.
I cannot give an exact number, but rough figures are as follows:
msg_list.Count > 1000 results in failure.
msg_list.Count < 600 result in success.

@mt1,

Thank you for sharing further details. A ticket with ID EMAILNET-39846 has been created as improvement in API to further investigate the requirements. This thread has been linked with the issue so that you may be notified once the issue will be addressed.