Is there any way I can read only last 1 hour mails in gmail.(Urgent)

Hi All,

I am working on some project in which I need to look last 1 hour mail only but the thing is I need to do it on gmail.
Is there any way?
Any help will be appreciated.

Thanks!
Anmol

What activities are you using to get the emails?

You can do something like this

mailDate = cDate(item.Headers("Date")) where item is a mailMessage

This will give you the date of the email, then you can use if condition and write something like this

if (mailDate < DateTime.Now AND mailDate > DateTime.Now.AddHours(-1))
{ then do your stuff}

Working fine at my end

Thanks,
Prankur

2 Likes

Hi @PrankurJoshi

Actually I am using GET IMAP Mail Messages activity to get all the mails.
I am sharing my workflow. Can you please take a look
Main.xaml (9.7 KB)

I am getting this error while working in this way .
Share

Remove last 5 characters from that string you are getting, then try to cast the date, I thin that will work.

Thanks,
Prankur

@PrankurJoshi,

Actually I need last 1 hour mail which I have received in my mail box. Some of the mails which I am receiving are from different timezone. In short I need last 1 hour mails which I have received in my mail box.
Then I guess last 5 characters are important for this conversion.

Get IMAP Mail Messages Activity.

@PrankurJoshi,

I debugged it and its look like when ever I will get the date in this format “Wed, 28 Nov 2018 04:30:30 -0800 (PST)” then it will throw the exception then I need to remove last 5 character.
Can you tell me how can I do that.

Thanks!
Anmol

See this sample, you can build your own code on it, might not be the best approach, but your post mentioned Urgent so you can use this

Main.xaml (8.2 KB)

Hope this will give you some insight

Thanks,
Prankur

Thanks @PrankurJoshi. I did that using substring and it is working fine.

Thanks a lot

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