The target principal name is incorrect

I have a windows automation that works perfectly fine on my dev environment physical machine, but intermittently faults on my test env server.

The same flow in Legacy does not ever error, irrespective of environment/machine.

The intermittent error is for any Exchange Mail activity: “The target principal name is incorrect”
Exchange mail config is:
Using EmailAutodiscover
Auth Type: UsernameAndPassword
accessing a shared mailbox

I have tried configuring the activities to point to different mailboxes and use different accounts credentials, the issue remains intermittent.

I have deleted the “.nuget\packages” folder to no avail.

Again, this issue is intermittent - it will work with the exact same config sometimes but not others with no change to the code.

full error text:
The target principal name is incorrect.

UiPath.Mail.ExchangeException: The target principal name is incorrect. at UiPath.Mail.Exchange.EwsClient.ExchangeServiceFactory.CreateConnectionWithLocalAuthenticationAsync(ExchangeConnection exchangeConnection)
at UiPath.Mail.Exchange.EwsClient.ExchangeServiceFactory.CreateConnection(ExchangeConnection exchangeConnection)
at UiPath.Mail.Exchange.Activities.GetExchangeMailMessages.<>c__DisplayClass52_0.<b__0>d.MoveNext()
— End of stack trace from previous location —
at UiPath.Mail.Exchange.Activities.ExchangeActivity`1.ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
at UiPath.Shared.Activities.AsyncTaskCodeActivityImplementation.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at UiPath.Shared.Activities.AsyncTaskCodeActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at UiPath.Mail.Activities.BaseMailAsyncActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

@Andrew_Bruce

Try using a retry scope around and give a wait of 5 seconds and check

Cheers

@Andrew_Bruce,

As it’s intermittent and you know the exact source activity which is faulting, Retry Scope is the solution here.

Thanks,
Ashok :slight_smile:

the issue will persist for anywhere between 15 minutes to 2 days at a time before resolving. When it is working it will work for the same before faulting again

@Andrew_Bruce,

Ohh that’s not intermittent then. It’s more likely issue of exchange server. Try to check with your exchange server admin for possible issue.

Thanks,
Ashok :slight_smile:

my assumption too. No progress on that front unfortunately. Trying to cover all bases. Thanks for your help!

1 Like