How to get specific value from the body of mail

email
activities

#1

I am working on UiPath and i want to extract specific value from body of mail . Below is body of mail look like
image
In this image I want the Full Name after Quicklook id i.e Johnson, Kim and kj250158 and want to store full name Johnson, Kim in separate variable and kj250158 in separate variable.
If you can please help me through this.


#2

Hi @programmer,

you can take body message into a string variable then do simple string manipulation as below

1.str = bodyStr.substring(“Quicklook ID:”) , it would return string after this “Quicklook ID:”.
2. str2 = str.split(’ 'c)
3. str2(1) will be first name, str2(2) will be last name and go on

Hope it will help

Best regards,
Avi


#3

Hi Avi,
Thanks for replying. When I tried your solution i faced one problem. Firstly i am explaining workflow which i used msg as a variable in for each such that for each msg in mail then in for each loop i take string variable var1= msg.body.tostring.substring(" ")
Then i am getting error option strict on disallows implicit conversion from ‘String’ to ‘Integer’. I am enclosing the error please help on this
image


#4

Hi Avi,

I even tried taking mailbody as String but still error persists.


#5

As per image change “mailbody” type from “GenericValue” to “String”
ind1=str.indexof(“quick”)+len(“quick”)
str.substring(ind1,str.indexof(“Division”)-ind1)


#6

I have one question if the body of mail looks:
**Additional Administrators:

Full Name: Bisen, Madhuri ; QuickLook ID: Mb185076

Full Name: Garg, Neha ; QuickLook ID: ng250098

Full Name: Hughes, Wesley ; QuickLook ID: Wh185051

I** want to store **Bisen, Madhuri in separate variable and **

Mb185076 in separate variable similarly i want to get

**Garg, Neha , **
ng250098 and then **
Hughes, Wesley , **Wh185051 ********

If you can help me through this , it will highly appreciable.

Thanks,


#7

Kindly find attach solutionemail string1.xaml (8.6 KB)
emlstr as emailbody, add to your datatable each name and id


#8

Hi @Atrimal

Can you please explain logic of while condition

ind<split(emstr,“Full Name:”).Length-1

Code is working fine but I’m not getting logic of above condition