Hi!
I’m trying to get the Headers(“date”) output equivalent in MailMessage to using Office365, specifically this format.
ddd, dd MMM yyyy H:mm:ss zzzz (UTC)
I’ve tried putting the Office365 mail to MailMessage but the Headers(“date”) is always blank.
I also tried using the Office365.ReceivedDateTime but it only outputs DateTime in "MM/dd/yyyy HH:mm:ss
Is there any office365 property to display the time format? It’s ok too if there is a way to convert Office365Message var to MailMessage var. correctly.
Thanks.
Hi @Shinjid ,
You can use
DateTime.ParseExact(System.Text.RegularExpressions.Regex.Match(yourString,“\d+\s+[A-Za-z]{3}\s+\d{4}\s+\d{1,2}:\d{1,2}:\d{1,2}\s+[-+]?[\d:]+”).Value, “d MMM yyyy HH:mm:ss K”, System.Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”)
Regards,
LNV
Use the “Get Outlook Mail Messages” activity to retrieve the Office 365 messages.
Use For each to iterate through messages, use the “Assign” activity to convert the date to the desired format.
receivedDateTime = DateTime.ParseExact(currentItem.Headers(“Date”).ToString, “MM/dd/yyyy HH:mm:ss”, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToString(“ddd, dd MMM yyyy H:mm:ss zzzz (UTC)”)
Sorry guys, I wasn’t searching well in the internet. Using .Headers(“date”) works just the same. I just had to update the version from 1.14.1 and newer(i was using 1.11.1)