Fix: (401) error while fetching mails using EWS in some cases

Fix: (401) error while fetching mails using EWS in some cases

Issue:

      Intermittently, user facing "Caused by: microsoft.exchange.webservices.data.core.exception.service.remote.ServiceRequestException: The request failed. The request failed. The remote server returned an error: (401)" error while executing the EWS API call (Say, while deleting an email) during Mail fetching.

      Reason for this could be expiry of the access token. While starting the mail fetching schedule using EWS, a new ExchangeService object will be created with access token. This access token is used for every EWS API call and it has an expiry of 1hour by default.

      If the schedule is running for more than an hour, this access token expires and subsequent EWS API call is thrown with (401) error.

Fix:

      Workaround has been prepared to check the expiry of access token before every EWS API call and renew it if it expires. This way, we can avoid the (401) error.

Steps to apply the workaround:

1. Download the attached 14006_8723450.fjar file.
2. Click here on steps to apply the fjar file.
3. Restart the application service.
4. Monitor for the issue.
5. If the issue occurs, immediately zip the logs (<server_home>\logs folder. For eg: C:\Program Files\ManageEngine\ServiceDesk\logs folder) and share it with us for analysis. If the size of the log file is huge, you can send it to us using our FTP link https://bonitas2.zohocorp.com/. Select the product as "ServiceDesk Plus" and ticket number as 8411003.



Jar compatibility

Build
FileName
14006
14006_8723450.fjar
                New to ADManager Plus?

                  New to ADSelfService Plus?

                    • Related Articles

                    • Fix: Processing mails using MIME after fetching using EWS

                      Issue: While processing e-mails using EWS, in some cases, the space character is missing between words that are formatted (color / bold etc.) Fix: Fetch mails using EWS and process them using the MIME content of the mail. The fix has been attached as ...
                    • Fix JAR for Parse Error Exception Raised during Mail Fetching

                      Issue : Some mail are fetched and created as ticket without description due to message corruption temporarily. The issue is can be identified with the below trace. Fix : The issue is not recreated when the mail is skipped to next schedule and fetched ...
                    • Problem in extracting emails via EWS from 11134

                      Emails getting fetched via EWS are getting failed to process and stops the Mail Fetching when that mail's object doesn't have InternetMessageHeaders. Note: This issue will not occur for all emails extracted via EWS except for the emails which don't ...
                    • Fix jar for EWS connectivity issue

                      Issue: In EWS for incoming, we are facing intermittent connectivity issues like 'unexpected end of ZLIB input stream', '(503) service unavailable', 'this connection to store is dead' etc. Resolution: Apply the attached fjar (Download the build ...
                    • Fix: Error while sending mail using EWS

                      Issue trace: [11:58:49:091]|[11-29-2022]|[SYSERR]|[INFO]|[122]: microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException: The operation can't be performed because the item is out of date. Reload the item and try ...