Topic
In this topic we will provide a troubleshooting guide on how to identify and resolve Exchange related problems you might face within the K2 product.
This guide does not cover all possible errors, but it will try to cover the most common issues faced by users.
In September 2019, Microsoft announced plans to turn off Basic Authentication for Exchange Web Services (EWS) for Exchange Online. An article released on the 1st of September 2022 announced that Microsoft will start to turn off basic auth for specific protocols in Exchange Online from the 1st of October 2022.
The following Microsoft articles have more information about the change:
In line with these changes from Microsoft, we highly recommend that you read through this article and make the necessary changes to your environment before reading through the examples below.
Example
Error #1
When actioning a workflow, you may notice your workflow email events fail to send. When reviewing the K2 Hostserver log files, you might see a generic error like this:
SourceCode.Workflow.Shapes.EWS: Autodiscover Failure: The Exchange server is not available, the password is incorrect or the e-mail address [email address] does not exist.
To determine the actual error, review the K2 Hostserver log files you found the above error, and look a few lines above it, you will likely find the real error. On newer versions of K2 Five (5.4 and onwards) the actual error is logged before the generic one.
Note: Within K2 Five you can disable the Autodiscover functionality, then it will not log the generic AutoDiscover error message. When there is an error, and the Autodiscover functionality is enabled, then it tries to Autodiscover, however that usually fails as well and a generic error message is logged.
For example, this can likely be the actual error above the generic one:
"Error","General","0","ErrorMessage","SourceCode.Workflow.Shapes.EWS ServiceRequestError: Workflow= '[Workflow Name]', PID= '2473', Event= 'Send Email', Activity= 'Send Email'","0 The request failed. The underlying connection was closed: An unexpected error occurred on a send."
When you see an error like this, its recommended to confirm you have the Minimum Requirements for the Transport Layer Security (TLS) 1.2 configured on your environment.
Once you have made those changes, restart your K2 Server and the error should disappear and you should be able to continue to use Exchange within the K2 Product.
Error #2
When activating the Exchange Online feature, you might experience the following error:
Something went wrong K2TSTS20002: An error occured while processing an authorization response (invalid_redirect_uri) The given realm has one ore more invalid redirect URIs. (http 500 error) Correlation Id: [Correlation Id]
How do you resolve this problem?
If you face this issue, please contact Nintex Support, and provide the following to the support engineer:
- Open K2 Management > Environment Library > Web Service URL value
- K2 Hostserver log files
Error #3
When switching from Basic authentication to OAuth authentication for Exchange Web Services (EWS) for Exchange Online, after you have configured it as per this article, you may see the following error in your K2 Hostserver log files:
"62763157","2022-09-22 12:59:01","Error","MessageBus","61012","ConnectionError","ExchangeWebServicesOrigin","61012 Exception from message source [emailAddress]: System.ArgumentNullException: Value cannot be null. Parameter name: token Server stack trace: at Microsoft.Exchange.WebServices.Data.EwsUtilities.ValidateParam(Object param, String paramName) at Microsoft.Exchange.WebServices.Data.OAuthCredentials..ctor(String token, Boolean verbatim) at SourceCode.MessageBus.Ews.ExchangeWebServicesConnectionStringBuilder.ExchangeServiceFactory(ITokenFactory tokenFactory) at SourceCode.MessageBus.Ews.ExchangeAutodiscover.Autodiscover(String emailAddress, ExchangeWebServicesConnectionStringBuilder builder) at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
To resolve this, your OAuth Resource value in the ConnectionStringEditor.exe tool needs to be the same as the Resource Name value within K2 Management. The OAuth Resource property value is the OAuth Resource Name for your Exchange Online integration.
Additional Resources
- K2 and upcoming changes to Exchange Online authentication
- How email functions are implemented in K2
- Code Fix: Integrating K2 with Exchange Online using OAuth
- Integrating K2 with Exchange Online using OAuth with lesser permissions
- Exchange Online Feature Activation