I am trying to get the second line of the email and store it as a variable. I am not sure how to use this? Each time I read the email I just want the second line stored.
Thanks.
I am trying to get the second line of the email and store it as a variable. I am not sure how to use this? Each time I read the email I just want the second line stored.
Thanks.
Try using the following pattern in Match activity:
(?:\r\n?|\n){2}(.+)
@srdjan.suc Once I get this extracted, how do I get the body of an email into the enumerable data type instead of the string from the body of the email. It is giving me error message
Fine
Hope these steps would help you resolve this
—use GET OUTLOOK MAIL activity and get the output with variable of type list of mailmessages, named list_mails
—now use a FOR EACH activity and pass the above variable list_mails as input and change the type argument as System.Net.Mail.Mailmessage
—inside the loop use a Assign activity like this
str_output = item.Body.Split(Environment.Newline.ToArray())(1).ToString
Where str_output is a string variable that holds your output with second line of the mail body
But ensure that the body of the mail has always a line with wordings in the second line
If there is blank line then we will be getting only blank as output
Kindly try this and let know for any queries or clarification
Cheers @amb13
@Palaniyappan
Yes, it is outputting a blank message box when I try to test it, so thats why I wanted to try a regular expression but it does not like the variable type for my email.
Fine let’s do one thing
Same steps but a little change
use GET OUTLOOK MAIL activity and get the output with variable of type list of mailmessages, named list_mails
—now use a FOR EACH activity and pass the above variable list_mails as input and change the type argument as System.Net.Mail.Mailmessage
—inside the loop use a Assign activity like this
arr_strings= item.Body.Split(Environment.Newline.ToArray())
Where arr_strings is a variable of type array of string
—now inside the current FOR EACH activity use another FOR EACH activity and pass the above variable arr_strings as input and also change the variable name from item to strings in the inner for each Activity
—so within this use a IF condition like this
Array.IndexOf(arr_strings,strings.ToString) >= 1 AND Not String.IsNullOrEmpty(strings.ToString)
If the above condition passes it will get into THEN part where use a writeline activity like this
strings.ToString which will give us the output we need
—followed by this activity still inside the inner for each loop use a BREAK activity so that it won’t iterate again and again once match is found
This would work for sure
Kindly try this and let know for any queries or clarification
Cheers @amb13
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.