Can you tell if you are getting any error? Or are you getting wrong output?
And if you need the date only then why not use directly in an assign activity varmailmessge.Headers("theheadername").ToString…if you dont know the header key name properly then run the bot in debug mode…go to locals panel amd expand the mailmesaage variable which will contain all the information and check the header name
I was using the simple ‘CDate(out_TransactionItem.Headers(“Date”)).ToString(“dd/MM/yyyy”)’ but for some unknown reason, specific emails don’t have the Headers collection full completed (missing lots of items like Date, etc.), so i am trying to use pure code to check if resolves the issue.
Thank you very much for the answer.
Seems that the code has no errors. Now, for testing it I need to convert my System.Net.MailMessage to MailItem so that I can input the var.
If the Final goal is to get the Date of the MailMessage, then even if you convert the MailMessage item to an Outlook Item, the Date would not be available.
I believe the fix was applied in the latest versions of the UiPath Mail Activities, so if you are already using the Latest versions, I do not think it would be an issue. Check the below post on the same. However a testing may be necessary to be performed.
The thing is that the existing mail activities are working fine for some emails, but not correct for other emails. And specifically the issue is noticed in emails of certain Outlook subfolder.
Already waiting for Windows Client answers on that, but i wanted to cover in parallel other ways of retrieving the Date.
Didn’t manage to run the Invoke Code activity, as i had to convert my input var, but the issue was solved by just upgrading the Outlook Mail Activities package from 1.15.2 → 1.18.2 version.