Error in invoking Microsoft Exchange Web Service (EWS) Managed API AutoDiscoverUrl method

Hi, I would like to use Microsoft Exchange Web Service (EWS) Managed API in UiPath to access O365 email. When I invoke AutoDiscoverUrl method from UiPath, I got the following error.

18.3.3+Branch.master.Sha.dad278851683d948236b522f6a0c8dd584803e65

Source: Invoke Method

Message: Autodiscover blocked a potentially insecure redirection to https://autodiscover-s.outlook.com/autodiscover/autodiscover.xml. To allow Autodiscover to follow the redirection, use the AutodiscoverUrl(string, AutodiscoverRedirectionUrlValidationCallback) overload.

Exception Type: Microsoft.Exchange.WebServices.Data.AutodiscoverLocalException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
Microsoft.Exchange.WebServices.Data.AutodiscoverLocalException: Autodiscover blocked a potentially insecure redirection to https://autodiscover-s.outlook.com/autodiscover/autodiscover.xml. To allow Autodiscover to follow the redirection, use the AutodiscoverUrl(string, AutodiscoverRedirectionUrlValidationCallback) overload.
at System.Activities.Statements.MethodExecutor.InvokeAndUnwrapExceptions(Func`3 func, Object targetInstance, Object actualParameters)
at System.Activities.Statements.MethodResolver.SyncMethodExecutor.BeginMakeMethodCall(AsyncCodeActivityContext context, Object target, AsyncCallback callback, Object state)
at System.Activities.Statements.MethodExecutor.BeginExecuteMethod(AsyncCodeActivityContext context, AsyncCallback callback, Object state)
at System.Activities.Statements.InvokeMethod.BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, Object state)
at System.Activities.AsyncCodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Does anyone have any idea what was wrong in the way I invoke the method?

Thanks a lot for your help.

Screen capture of how I invoke the method.

Thanks a lot for your help.

@Michael_Wu

Did you ever find a solution to this problem? I’m having the exact same issue.

Thanks,
Brad

Hi Brad,

I did not have time to investigate the cause and possible solution of the issue at that time. Instead I wrote a custom activity to initialize the exchange service. That has worked for me so far.

Regards, Michael