Unable to add mail message to Queue

I am using Microsoft 365 scope ->get mail activity to read the mail from outlook.

I am trying to add mail message to queue
image

Getting below error
Add Queue Item: Could not determine JSON object type for type UiPath.MicrosoftOffice365.Models.Office365Message.

How to add mail message to queue.

You can’t add complex datatypes like that to queue items.

Hi @balanirmalkumar.s

use get mail with include mime content checked then for each mail use save mail message with mail as input and filepath “temp.eml” then read mail message from file with “temp.eml” output to mailMsg then add queue item with specific content fields like “Subject” = mailMsg.Subject, “Body” = mailMsg.Body, “From” = mailMsg.From.ToString

If you found helpful please mark as a solution. Thanks
Happy Automation with UiPath

Well… you kinda can. But you have to serialize them first and deserialize them on the other end, and sometimes it will accept a more complex type if it can be easily serialized.
Thats abit semantic of course, cause if you turn it into a string its technically no longer a complex object.

However, I digress.
The real issue here is that a O365Message is not serializable if I recall correctly.

It requires a connection to the mailbox, and trying to put it to a queue item breaks that, its only possible to pass detail of the queue item, such as the ID, so that you can find the email again in the performer consuming the queue item.

@balanirmalkumar.s,

I have automated similar requirement with the below approach.

  1. Get email’s MessageId which will be unique identifier of the email in string format and add that to queue.
  2. In performer part use this message id from queue and pass it to Get Email By ID activity to get that email object for further processing it.
2 Likes

You don’t have to save the email then read it in order to get the body, subject, etc.

You just get those things from the email variable output by the Get Mail activity.

The scenario is in dispatcher(Init state) i need to read the mail. In performer (process state) i need to move that mail to another folder(Bot processed). If i am using Move mail activity from Microsoft 365 classic. It requires mail message as input.

For above scenario we have any other alternative options?

@balanirmalkumar.s,

Why this is in initialization state? That’s not the right place to add queue item.

Go through my answer again I explained how to get that mail message from message id. Follow the approach and you should be good.

@balanirmalkumar.s

Save the message id in queue

Use message id to get the mail and move in performer

Cheers

In move mail activity i am getting below error

Move Mail: Code: BadRequest
Message: /me request is only valid with delegated authentication flow.

@balanirmalkumar.s

Please fill the account field with the email ID you are using as from

cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.