Getting a MailMessage from TransactionItem

How can I assign to a variable the TransactionItem.SpecificContent( “Mail” ) if “Mail” is of System.Mail.MailMessage type?
Something like: Mailitem = …TransactionItem.SpecificContent( “Mail” )…

Yes buddy but the Mailitem variable should be of mailmessage type

Cheers @Astearon

When trying this i get the following error:

MailItem is of MailMessage type but i do not know how to tell uipath to load TransactionItem.SpecificContent( “Mail” ) as a MailItem

1 Like

Aaahah, buddy i think i have misunderstood the question, fine here you go
the output that we get from get transaction item is of type object and you cannot assign it directly to a variable of type mailmessage (its of format .msg) So its not possible to send as such, and may i know why would you like to convert as a mailmessage buddy …are you trying to send any mail after getting transaction buddy @Astearon


I want to upload as a queue item the whole mailmessage since i will need the .msg or .eml file later in my process and I also need it’s attachments and body info.

I thought the best way would be to upload the whole mailmessage as a transaction item in the queue

Buddy this would surely help you buddy

Kindly try and let know buddy @Astearon

1 Like

Did that work for you buddy

Cheers @Astearon

@Palaniyappan, this kind of works for me.

From what I see, after I upload all the ItemInformation from the mailmessage I can then create a new mailmessage, push to that one all the info and then save that mail locally as eml.

If I upload the attachments as an Object Type inside the ItemInformation collection will I be able to read them back from the TransactionItem?
Or do i have to split the attachments up before adding them to the collection?

I ask because some attachments might be images or PDF files but I am interested if the mail has an xlsx file.

1 Like

Buddy you must separate the images or any pdf or any other files before the mail content is been added to the queue as collections, as the queue will not be able to get those format of files to their collection of objects… @Astearon

Did this gets resolved now, do we need to tweak a bit more on this… buddy …?

Got it, so i need to split the attachments up by individual types and keep only what i need , once i have the xlsx i upload that to the collection as a DataTable for example and re-create the xlsx in order to add it back as attachment once i need to save the .eml file.

I think i understand now.

1 Like

Exactly buddy @Astearon , well but you cannot add the datatable directly to the queue rather you can do like

  1. Store file location instead.
  2. Serialize yourself. Import namespace Newtonsoft.Json, then use JsonConvert.SerializeObject(yourObject) to make it a string and store that. When getting object from queue use JsonConvert.DeserializeObject(Of DataTable)(queueItem.SpecificData(howyounamedit))

if this makes clear , kindly close this topic with the right comment marked as solution that could help others as well

Cheers @Astearon

1 Like

Could i instead save the xls as a CSV and save that to the collection ?
I have no experience in using JSON serialize but will try if that is the only way.

1 Like

Here you go with xaml that i had for reference ( obtained from our forum ), hope this would help you too , check with enqueuexaml buddy that looks cool @Astearon (13.8 KB)

1 Like

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