How to read attachment file name from email

Hello,
Still new to UI Path and learning each day.

What I want to achieve is to read a certain part of an attachement title from an email, copy it and paste in another application.

Is this possible?

Thanks,
Scott

1 Like

You have to save the attachment on the local machine. After that you can read the file name from the saved folder.

1 Like

Hi Scott,
Yes, it is.

First you need to get the mail message - using one of “Get *** mail message” activities.
Next you could get names of all attachments from Name property of Attachments collection of MailMessage returned by the “Get *** mail message” activity.

e.g. assign below will get name of first attachment

AttName = MailMessage.Attachments(0).Name

Cheers

3 Likes

@J0ska thanks for this, what is the VB expression in the Assign activity?

1 Like

Have a look at attachment…

GetAttName.xaml (8.4 KB)

1 Like

Sorry still not getting it. emails with attachements(PDF) with only the date difference in the title are sent in each Wednesay. I want to copy part of the PDF title and search that copied text in a difference application

1 Like

Hi Scott,
In the subject you wrote “read attachment file name from email”

This is exactly what the example wf does:
1/ It retrieves main messages
2/ Loops through all attachments of every retrieved message
3/ Display the attachment name

Or do you need something else?

Cheers

1 Like

Sorry I may have worded it incorrectly. This is what I want to do:

Email arrives on a Wednesday morning with a PDF, it has in the file name a unique number, I want to copy that number, open another application and search for it, once it finds a person I want to then copy a unique code and then open the PDF and paste the code in the password field and then print a file.

There can be around 80 emails to do this for.

Is it possible?

1 Like

Should also point out I’m using the studio version

1 Like

So I would recommend the following approach:
1/ Get mails and save all PDF attachments in TEMP folder
2/ For each PDF file in the TEMP folder

  • get unique number from the file name
  • open another application and search for passcode
  • open and print the PDF

Simple skeleton in attachment

GetAttName.xaml (8.9 KB)

2 Likes

@J0ska that’s perfect got it to work thank you. Only problem now is becuase it’s a mailbox within my own mailbox it doesn’t recongise the “Inbox”

1 Like

No experience with such setup.

Search or try another question :slight_smile:

1 Like

You’ve helped a great amount @J0ska thank you. It’s greatly appreciated.

1 Like

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