Topic
Task Notifications fail to send out because Exchange Online is returning a (403) Forbidden error:"Error","General","1","GeneralErrorMessage","EwsMessageDestination","1 SourceCode.MessageBus.EwsDestination: Email Send Falied, Error: Microsoft.Exchange.WebServices.Data.ServiceRequestException: The request failed. The remote server returned an error: (403) Forbidden. ---> System.Net.WebException: The remote server returned an error: (403) Forbidden.
at System.Net.HttpWebRequest.GetResponse()
at Microsoft.Exchange.WebServices.Data.EwsHttpWebRequest.Microsoft.Exchange.WebServices.Data.IEwsHttpWebRequest.GetResponse()
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(IEwsHttpWebRequest request)
--- End of inner exception stack trace ---
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(IEwsHttpWebRequest request)
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(IEwsHttpWebRequest& request)
at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute()
at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalCreateItems(IEnumerable`1 items, FolderId parentFolderId, Nullable`1 messageDisposition, Nullable`1 sendInvitationsMode, ServiceErrorHandling errorHandling)
at Microsoft.Exchange.WebServices.Data.Item.InternalCreate(FolderId parentFolderId, Nullable`1 messageDisposition, Nullable`1 sendInvitationsMode)
at Microsoft.Exchange.WebServices.Data.EmailMessage.InternalSend(FolderId parentFolderId, MessageDisposition messageDisposition)
at SourceCode.MessageBus.Ews.Destination.EwsMessageDestination.SendMessage(ExchangeService service, String title, MessageExtendedInformation extended, IEnumerable`1 attachments, MessageBodyReader[] messageBodies)"
Instructions
The (403) Forbidden error message indicates that the API call to send out an email via Exchange Online was denied access. You must check if the K2 for Exchange Online App is granted access to the K2 service account's mailbox. The output of the Powershell command below will indicate whether the app has access:Test-ApplicationAccessPolicy -Identity '{K2 Service Account Email Address}' -AppId '94df5a56-cc88-4652-9c6a-3ce5450777fe'
For example:
Test-ApplicationAccessPolicy -Identity 'k2svc@k2test.com' -AppId '94df5a56-cc88-4652-9c6a-3ce5450777fe'
On an environment with working task notifications, this should return AccessCheckResult = Granted. If this command returns AccessCheckResult = Denied, you will have to check with your Exchange Online Administrator if there is a policy in place to deny the app's access to the K2 service account's mailbox. For more information, refer to: Limiting application permissions to specific Exchange Online mailboxes