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
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’”.
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
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 item.de.contains(“Jean Dupont”)…but sorry buddy i dont know what is the objet and de…
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).
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)?
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”
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