Get exchange mail from shared mailbox

Hi guys

I want to be able to get/move/delete etc. emails on the shared mailbox. This mailbox is not placed on the office365.

I tried using ‘Get Exchange Mail Message’ activity and it seems that server itself is correct but every time I receive an error. I tried this with SharedMailbox specified, MailFolder specified as “sharedmailbox@domain.com\Inbox” and basically anything I could think of. This is the error I receive

An error has occured

Message: ISerializable type ‘Microsoft.Exchange.WebServices.Data.ServiceResponseException’ does not have a valid constructor. To correctly implement ISerializable a constructor that takes SerializationInfo and StreamingContext parameters should be present. Path ‘Error’, line 1, position 1181.

Source: Newtonsoft.Json

Exception Type: JsonSerializationException

Summary

Newtonsoft.Json.JsonSerializationException: ISerializable type ‘Microsoft.Exchange.WebServices.Data.ServiceResponseException’ does not have a valid constructor. To correctly implement ISerializable a constructor that takes SerializationInfo and StreamingContext parameters should be present. Path ‘Error’, line 1, position 1181.
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateISerializable(JsonReader reader, JsonISerializableContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at UiPath.Shared.JsonParser.DeserializeObject[T](String jsonValue)
at UiPath.Models.UiPathDuplexProxy.<>c__DisplayClass21_0.b__0()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

While this is the error I receive in the Ouput Pane

Get Exchange Mail Messages : The SMTP address has no mailbox associated with it.

I tried to search for a solution based on the error in the output pane. What I came across is this topic
Social MSDN Forum - SMTP Error while impersonating

I also did a check of this shared mailbox I’m trying to get emails from on Microsoft Connectivity Test with Sevice Account Access (Developers). On this site test is failed if I enable “Use Exchange Impersonation” with an error “ErrorImpersonateUserDenied” and it’s successful if this option is disabled.

This led me to believe that the problem may be caused by UiPath exchange activity trying to impersonate a mailbox but I don’t know if there’s a way to make UiPath not do this.

Any help would be much appreciated.
Thanks

I think it is a known issue. @Cosmin_Ion_Nicolae

Hello. We are currently investigating the issue. I don’t think we can query the email server without using impersonate, but still we will document it as known issue. Thank you for the feedback.

Hello everybody,

I think I found a working solution.

If you use Get IMAP Mail Messages activity with such user name as email@domain.com/sharedmailboxalias then you’re able to get shared e-mail’s mailbox’s mails.

It is tested and works with IMAP activity.

Best… :slight_smile:

3 Likes

Hi Ahmet,

Thank you for sharing your solution with all of us.

@Gabriel_Tatu please take a look

Hi All,
@ 2aozturk @badita
Using exchange email -get email activity only fetch the current date email …can you please let me know how can we fetch the older email using exchange service in uipath

Regards
Raj kumar

Hi, I know this is an old post but did anything come of this, I’m still having this issue now? Thanks

The latest version of Mail.Activities starting from 10.5 requires sender details.
Please provide the exchange mail address in properties (Sender:From)