Error Using the Pharase Convert.ToDateTime(currentItem.Headers("Date")).ToString("ddd;dd-MM-yyyy HH:+mm:ss")

Dear Experts,

I am trying to build this automation in the lesson: Email Automation With Studio Course | UiPath Academy.

I have followed each and every word said in the video, with care. Yet there are a couple of errors that I get when I compile the process:

Error ERROR Validation Error BC30456: ‘Headers’ is not a member of ‘List(Of MailMessage)’. Main.xaml

Error ERROR Validation Error BC30456: ‘Body’ is not a member of ‘List(Of MailMessage)’. Main.xaml

Error ERROR Validation Error BC30311: Value of type ‘String’ cannot be converted to ‘MailMessage’. The selected value is incompatible with the property type. Main.xaml

Error ERROR Validation Error BC36754: ‘List(Of MailMessage)’ cannot be converted to ‘IEnumerable(Of String)’ because ‘MailMessage’ is not derived from ‘String’, as required for the ‘Out’ generic parameter ‘T’ in ‘Interface IEnumerable(Of Out T)’. The selected value is incompatible with the property type. Main.xaml

I am using the 2025.0.161 Community license Studio.

Consulted online resources for debugging the error as it seems obvious. But I have declared those variables and can’t figure out where the issue is…

Kindly help.

Main.xaml file attached.

Main.xaml (17.2 KB)

Hi @Musa_Sharif

I’ve checked the errors and fixed them. If you need an explanation on the errors and why they happened, let me know. I’ll explain.

Main.xaml (17.4 KB)

If this solves your issue, Do mark it as a solution.
Happy Automation :star_struck:

2 Likes

this pretty much applies to the other errors too.

Headers or Body are properties of a mailmessage object.
So myMailmessage.body is valid.

However List(of Mailmessage) is not a mailmessage, but a collection of objects. The .body reference then applies to the list object, and not to the mailmessage.

In order to target a specific mail message you can use myList(0).body, where (0) refers to the 1st mailmessage in the collection. Alternatively to calling memners individually you can loop through them using ‘for each’ constructs.

Handling collections are fundamentals of programming. Reading up on these subjects can prevent confusions next time.

Thanks a bunch for the explanation.

I understand I need to know programming and I have taken basic courses during my Bachelor’s degree, such as Matlab and C. But I don’t see I have learnt what UiPath mentions because it either uses C# or VB. Can you recommend something where I can learn at least the concepts related to expressions used in activities of UiPath?

Hi @Musa_Sharif

You can go through some of the basic courses/learning paths available on UiPath Academy. Such as:

Along with these courses, going through videos on youtube and help from community Forum as and when needed, You will eventually get a hang of things.

@Jeroen_van_Loon , @V_Roboto_V

Thanks a bunch for the help guys.

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