Obtain a code from the body of an email



I need to copy a number from an Outlook email (for this I use the get email activity) and I get all the mail content correctly, the question is how do I copy the number that i requires (“nro. de siniestro:”) of the email?
the format is as follows and what I have to select, i mark it in yellow

thank you very much !!


Hi @Braki,

using string.substring you can get last index of the NRO. SINIESTRO: then if the length of the string you looking is constant use the index you got from the above statement and this length to get the desired string


By using foreach loop take Item.body then store it in a variable by using the length u can substring the number


How would the code you would have to use?


You can get index of NRO. SINIESTRO and NRO. EXPEDIENTE using String.IndexOf function. after getting index value, you can use Substring to get the required value.

Please see the attached workflow.
Main.xaml (10.1 KB)


Hi Santan

I try to prove your process but I received length error, I send you the format of the email in plain text so that you can indicate me the correct way to obtain the required number, that is, the number of sinister (NRO. SINIESTRO: )

FECHA: 10/07/18
NRO. SINIESTRO: 501360117000674
POLIZA: 5005010422796
SUB MODELO: D/C High Country 2.8 CTDI
A?O: 2017
PERITO: DA SILVEIRA SCARABELOT, GILSON ## gidasil@mapfre.com.py, repuestos@mapfre.com.py

contenida en este mensaje y archivos adjuntos
es privada, confidencial y de uso exclusivo de
la(s) personas(s) y entidad(es) a la(s) que va dirigido. Si Ud. no es el destinatario de esta informaci?n se le notifica que est? expresamente prohibida la declaraci?n, reproducci?n, distribuci?n o la toma de cualquier acci?n basada en el contenido de esta comunicaci?n. Si ha recibido este mensaje por error, le rogamos que nos lo comunique inmediatamente y proceda a eliminarlo. Mapfre Paraguay no asume responsabilidad legal por el contenido de esta comunicaci?n, ni el presente mensaje representa la opini?n de la compa??a, salvo que expresamente se especifique lo contrario y que el remitente est? autorizado para hacerlo. El contenido de este mensaje y cualquier archivo adjunto son de exclusiva responsabilidad del remitente y no comprometen a Mapfre Paraguay, salvo autorizaci?n expresa del Directorio de MAPFRE, del Presidente, o del Director General.-------

thank you very much


i = Int32
strScrapeNumber = String

i = MailItem.Body.indexOf(“NRO. SINIESTRO:”)

strScrapeNumber = Trim(MailItem.Body.SubString(i+15, 15)

Given that the number you want to scrape is always 15 characters.


Hi @Braki,

I have updated Workflow, According to your requirement, Please Check this.

Main.xaml (10.4 KB)


It worked perfect! Great job. The downside now is that when I want to paste the variable (NroSin) in some field is like had an enter incluide, paste and automatically Simulate the ENTER key. how can format it to just paste the text of the variable and do not do any action?


You can use Trim function to remove extra spaces from both side.

For Example : NroSin.ToString.Trim


Hi Santa,
if I also want to capture the file number (“NRO. DE EXPEDIENTE”) it can be “/ 1” or “2” as would be the portion of code that I should add?


and email of “PERITO” ej “gidasil@mapfre.com.py” the second mail I do not need it.