How to get all mails from outlook using get imap

i can get upto top 40 mails, fields like from, to, cc and all… instead of 40 mails i want all the emails from inbox so may i know how to get all emails fields from inbox? i tried with removing top 40 but it didnt work

Hey!

We can use get outlook mail message activity to get the mails from outlook…
Get imap is used to get the mails from gmail…

As per the requirement follow the below steps…

drag the activity and provide the necessary details…

check the only unread mails and there provide the 40 mails to be retrieved

Now create the output varible-Type is-List<Mail.Mailmessage>

take one for each and pass the list of mail message

inside the for each you’ll get the each mail at a time…

Extract the details…

Regards,
NaNi

Have you ever checked the properties of the activity? What parameter takes “Top” property in your case?

example

sorry bro but get imap also works for outlook

yes i have cleared the top 30 but i what i want are all fields from all mails in inbox

if i clear top then run my bot it shows error like timed out on imap

Try to write Int32.MaxValue to the Top option. Please let me know if it works

may i know how to do this please

Just write into the top field as shown below:
Int32.MaxValue

thanks will try this and will update u

1 Like

Bzural again it throws error like Get IMAP Mail Messages: The operation has timed out.

Can you share your workflow and activity’s property with me?


please check it

First of all, you should change int32 → Int32 (i must be capital). Second one is why you are trying to get all your e-mails? Because when you have thousands of emails then it will take too long. I suggest you should avoid to get all of them. But if it is the unique solution, according to the amount of your email you should change the timeoutMS property, because it is fixed to 30 seconds.

yes u r right if mails are too much then it will suffer to take all mails details… so lets take like i want mails for yestaday to today or saturday to monday or only for today, so do u know how to write if else condition for these three methods ?

Yes, let us see if these conditions work for your cases:

This is for yesterday to today:
Convert.ToDateTime(mail.Date()).Day <= DateTime.Now.Day & Convert.ToDateTime(mail.Date()).Day > DateTime.Now.Day-2

This is only for today:
Convert.ToDateTime(mail.Date()).Day = DateTime.Now.Day

This is to compare the day as day of the week:
Convert.ToDateTime(mail.Date()).DayOfWeek.ToString().Equals(“Tuesday”)

I hope that works :smiley:

1 Like

hey Bzrural im really sorry i didnt see your message… thanks for the effort reply… may i know how to implement this conditions in my workflow?

Exactly you can not implement these conditions while you are getting the emails, but after you got, you can check the emails. According to them, you can do anything you want with them.

If you share a specific case, I can help you better.

1 Like

ok bzural u r saying these conditions for after im getting mails thanks for that… but since im having issue to get all mails like timed out error… so may i know how to get filtered time mails like using time stamp to get filtered time mails?

Oh sorry, I thought that you passed that. Then I suggest you to do:

  1. Adjust conditions into FieldExpression field like it is shown below:
    filter

For more information you can find here: https://docs.uipath.com/activities/docs/get-imap-mail-messages#filtering-examples

  1. If it is still giving timeout error, you should change the TimeoutMS, property of Get IMAP Mail Messages 30 seconds=30000 miliseconds.

Please let me know, if it works