Issues with filter option in get outlook mail message


I have issues with “get outlook mail messages” filter. Please note that my Outlook is in french.

I need to get an email which is a forwarded email, so the object of the email is “TR: Results mars 2019”. If I filter on '[Object]='TR: Results mars 2019", I have a error message at the following step (save email) which is “Index was out of range. Must be non-negative and less than the size of the collection”. I imagine that it is because it hasn’t found any email.

=> Is it due to the fact that the email is a “forward” (as I have no issue if the object doesn’t contain “TR:”)? How can I solve that?

I take the opportunity of this email to ask you two other questions on the filter :slight_smile:

  • If part of my subject changes every month, because it contains the month (subject = Results of month 2019), how can I do? Is it possible to put contains instead of equal? and if yes, how should I write the function?
  • Is it possible to combine two criteria? Here is my filter : “[Objet]=‘Results Mars 2019’” And “[De]=‘Jean Dupont’” and I get this message error “Option strict on disallows implicit conversion from ‘String’ to ‘Long’”.

Many thanks for your help!

Hi @Sara_21,

Buddy, thats an amazing question…


So coming to the point,

  1. for first question, yes buddy you can contains. kindly follow the below steps
    –use get outlook mail activity to get all the mail messages and would get saved to a variable of type mailmessage
    –use a for each loop to iterate through the mailmessages
    –use if condition, where the condition should be like
    item.subject.contains(“your string to be found”)
    –if that specific mail message in the iteration has that subject you can proceed with any activities you want in then condition, else with other activities you want in else part

  2. For second question
    –yes you can pass two criteria like this
    “[Objet]=‘Results Mars 2019’” And [De]=‘Jean Dupont’”, (same as you mentioned…but removed the double quotes before [De], else you were doing amazing)
    and kind suggestion is you can do this in either way like with filter property in outlook activity or even if condition like
    item.objet.contains(“Results Mars 2019”) and“Jean Dupont”)…but sorry buddy i dont know what is the objet and de…

thats all buddy, you are done…

Hope this would help you


Many thanks, I will try!

“De” stands for “from” and “objet” for “subject” :slight_smile:

1 Like

Thats amazing, buddy kindly let know if it works or not…


I confirm it works!
I have two other questions:

Sorry I sent my message without my questions

  1. I would like to sort my emails depending of the condition. I don’t know how I should write the path of the subfolder. I have a subfolder “OK” and a subfolder “KO”, both of them being under my “Boîte de réception” (i.e. my inbox).

  2. How can I save each mail that meet the yes condition under a different name (to avoid to replace the previous email by the new one)?

Thanks again for your help, it is really useful!!

No Worries buddy @Sara_21,

Here is your answer,

  1. Yes buddy you can access the mail from subfolder by mentioning in folder property like
    “Inbox\OK” - For subfolder “OK”
    “Inbox\KO” - For subfolder “KO”

  2. Kindly correct me if I understood the question correctly or not, so
    I don’t know either you would like save the mail or mail attachments, with different names
    –Yes, to the mail message with different name we can save the file with mailsubject and receivedtime of the mail as string concatenated, all with save mail message activity
    –Or if you want to save the attachments of the mail you can use save attachments activity where you will mention the folder path and mail message variable. You can keep this inside for each loop with mail message collections as input and, use folder path being same + timestamp or counter in string concatenated form as path input

Hope this would help you


  1. It works!
  2. It was your first point, and it works too!

I have completed my mail automation process thank to your help: thank you for that!!

1 Like

Thats amazing…kindly close this thread with solution marked so that it would help others looking for solution under you topic

Cheers buddy …keep going…

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