Need help to my eksame

I am new in this UI path, with start training.

I need to save an attachment from an incoming mail under a folder by ID number and there under a category F.ex. House, pension or others.

Mail subject = 12345678 House

I need to extract the ID number and the category under separate variable from the mail.subject.

I know I need to assign ID var. to Mail.subject.split(“ “) But how do I select the first part to ID form this ?

Then I need it to save the attachment files, under the first part: ID, from subject and under the second part of subject, category.

I have seen a lot of videos, but can´t figure this out

I need this for my exam in 5 days, so I really need help!

Hi buddy @Rene_Nielsen
Welcome to UiPath community.
Fine

  1. Once after getting the mail messages as a collection from any of the get mail Activities with a variable named outmailmessages
  2. Now use a for each loop and pass the above variable as input and chanthe tyoe argument of for each loop as mailmessage
  3. If use a assign Activity as you said like this
    Out_Id = Split(item.Subject.ToString," ")(0).ToString and this works only if the subject is 12345678 House this…as the number is in first position we have mention the split index as 0
  4. Then to save the category use a assign activity like this
    Out_category = Split(item.Subject.ToString," ")(1).ToString
  5. Then use a save attachment Activity where mention the mail input as item the variable from for each loop and attachmen folder like this
    Out_category\+"yourfilename"
    Or
    Out_Id\+"yourfilename"

Either of the you want
6. This will save the file from the mail to the folder named with Id or category as per our choice.

Hope this would help you buddy
Cheers @Rene_Nielsen

Split(item.Subject.ToString," ")(0).ToString
It´s is not taking it as a variable

What am i doing wrong?
Thank u for your help! <3

1 Like

Kindly change the type argument property in for each loop as mailmessage
Cheers @Rene_Nielsen

TypeArgument is set to System.Net.Mail.Mailmessage

Kindly get the cursor to that blue symbol at the edge of the activity, we can see the error message buddy…kindly share that screen shot
We are almost done…
Cheers @Rene_Nielsen

Here :slight_smile:

image

Don´t know if this helps.
I have been working on this for 9 hours today, i think i need a break form it.

Thank you so much!

1 Like

@Rene_Nielsen

Just change ‘item’ in your expression editor to ‘mail

that should fix it.

Regards :slight_smile:

PS : Explanation :- you are looping the whole collection in a ‘for each’ loop. So it is defined as 'for each item in ‘‘your collection’’ ’ which apparently you changed the ‘item’ variable to ‘mail’.

No worries buddy @Rene_Nielsen
The reason is there is a change been made in the variablename in FOR EACH LOOP, where the actual name would be item, but its been changed now to mail, and the expression that i was suggesting takes on variablename item…
Fine
Just we need a small change
Change it to like this with the expression in the assign Activity
Split(mail.Subject.ToString," ")(0).ToString

You are done
Have a great day
Cheers @Rene_Nielsen

1 Like

That part works now!

Thank you!

1 Like

Fantastic
Cheers @Rene_Nielsen

Now i need to save the attchement file under the CPR number, and IN that folder, under the rigth Categori.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.