Using Gsuite package to capture attachaments

Hello Community ,
First of all , a pleasure to greet you peeps !

Being that said I would need your help with the following.
I am currently drafting an automation that aims to capture a specific file from an email from my Gmail inbox and then , ideally , download it and store it to a specific folder.
So far , while using Gsuite package I´ve been able to configure the scope with no major problems and I can see the auth going thru just fine.
When it comes to reading the messages and downloading the files I am now facing some issues . Here´s what I´ve done so far :
I have my getMail acitivity configured with its parameters which results on an output which I´ve named MAIL (it is a GmailMessage variable )
After my getMail I am including a FOR EACH loop and whitin my FOR EACH body I added the SAVE ATTACHMENT activity.
Inside the latter I´ve specified that for each mail whithin my Mails the attachment is to be saved on a given folder but when it comes to the dubbuging process I get the follow error :

Error de validación Se encontraron errores del compilador al procesar la expresión “mail”.
Un valor de tipo ‘1-matriz dimensional de UiPath.GSuite.Models.GmailMessage’ no se puede convertir en ‘System.Net.Mail.MailMessage’. Main.xaml

A quick translation would be : A type 1-dimmensional matrix from UiPath.GSuite.Models.GmailMessage cannot be converted to a System.Net.Mail.MailMessage

I´ve specified in my FOR EACH TypeArgument that I will be passing a GmailMessage as shown below :


Still I am getting the same error. Any idea on how can I solve this ?

Thanks in advanced for your time.


@Eduardo_Martinez - Could you please share the screenshot of the workflow?

Also please check this post…it may help you…

Hello @prasath17 !
Thanks for your reply .
I will be taking a look at the articule you mentioned , in the meantime , here´s my flow :

@Eduardo_Martinez - Can you try this…


Reason why I used substring (0,3) is : some email contains , : " characters which is not supported in the folder path. So you will get an error…




Hi @Eduardo_Martinez …Have you tried the solution provided? pls update

Hello @prasath17 !
Sorry for the daly on this reply .
I tried your solution and worked correctly, now I am facing the challange of renaming files. My idea is to name the file with today´s date. Should I use the move file feature in order to move it and re name inside the same folder ?
I´ve been going thru some articles so far but I can´t find any specific example that fits my current situation.

@Eduardo_Martinez - Thanks for the confirmation…

You want something like this…


Code: “Attachments” + Mail.Subject.Substring(0,3) +"_"+“MM-dd-yyyy”)+".eml"

@prasath17 you are right , my problem is that while trying to it , the system returns :

ERROR Validation Error Compiler error(s) encountered processing expression “email+ email.Subject.Substring(0,3) +”_"+“MM-dd-yyyy”)".
The operator ‘+’ is not defined for the ‘System.Net.Mail.MailMessage’ y ‘String’.types . Sorry for the back and forth you´ve been more than keen

@Eduardo_Martinez - you are missing the double quotes…

Please look refer my code…

Here is Attachments is the folder name…This will create folder Attachements folder inside you Uipath Project Folder(where your xaml file is)…

Please try to copy as is first…once worked you can make modification…

Hi @prasath17 ,
I copied the information using the shared code (your image) the only detail I had to change was : your mail variable on my end is email and in your case the attachment folder was named with capital letter A and on my end I used all lower , never the less I´m still getting an error. Here´s my info

My error states the following :

Error ERROR Validation Error Compiler error(s) encountered processing expression ““attachment” email.Subject.Substring(0,3)+”_" + DateTime.Now.ToString(“MM-dd-yyyy”)+".eml"".

@Eduardo_Martinez - you are missing the plus sign again…

This is mine…

This is yours…


are you able to find , what you are missing???

After the image you are missing + sign …please fix it…

Also please create a folder called attachment or Attachment in your project folder…it is case sensitive

Share your xaml file if possible after removing your API key , str etc etc…I will fix it and share it with you again…

@prasath17 !
New error now , Im getting Save Mail Message: The given path’s format is not supported.
I read something about multiple dots in the file name, is it possible ?
Also , attached , you´ll find the XAML that im using now.

Main.xaml (22.3 KB)

@Eduardo_Martinez - Great Progress…you are almost there…

I think your email subject line contains illegal characters like(, " ’ : ; etc etc) which are not supported for folder creation…

Once you find that out, you will be able to resolve it…

Even I faced the same issue, that’s why I extracted only first 3 bytes for my testing( email.Subject.Substring(0,3) ) and it worked…