Issue when reading filename extension

I would like to let my script do the naming of the PDF files it generate. It work but when I want to attach the files in e-mails using the Outlook module, I need a solution for reading the file extension (PDF) in the filename.

When I run the script can read the filename but it can’t read the file extension.

The scrpt line I need to fix:

Can you help me ?

Best regards

Thomas

@thomas2

May I know from where you are trying to read the extension and what is the object that you have currently?

cheers

Dear Anil

Thank you for writing. As newbye I can’t upload so many pictures to visualize.

I use the module “Send Outlook Email” because I want to attach the PDF file in an e-mail.

With the line I show you, I can read the name of the file but I need to read the extension too.

Best regards

Thomas

Here you can see the Outlook Module:

@thomas2

okay so as I understand you want to attach a file in email and in send outlook mail message activity…but where are you getting the file from?

ideally if you are trying to get the file from local computer then it would be uisng the path.if you have a folder we can try to get the files from there using Directory.Getfiles function…

are you trying to get the file from excel?

cheers

Dear Anil

I get the PDF file from a folder on my computer.

The script line I show you, can by “FName” (column name in Excel sheet) read the filename from the PDF in the folder but to attach the file it need the extension too. Here I get the trouble.

Best regards

Thomas
.

Hi @thomas2

if there are only filenames written in excel file and you know that each file would of type .pdf, you can add .pdf while attaching the file at the end.

Or else if you’re creating this excel somehow, please use FullPath while inserting data into excel.

Dear all

Thank you.

In the above 2 reply’s you should have my script.

Thank you in advance.

Best tegards

Thomas

Dear all

Please find below my solution.

Best tegards

Thomas

12:23 26-07-2023 - Script read name, birthday and e-mail from Excel file, generate a Word file and save it as a PDF, which are going to be send to the e-mail read from the Excel file.

1.1 Single Excel Process Scope (SequenceX)
Private = False
Variables
Notes(IWorkbookQuickHandle)
Destination_Folder(String)
Source_Folder(String)
Activities
1.6 Move files and Folder from one location to another (Sequence)
Private = False
Activities
1.50 Enter Source Folder location (Assign)
To variable = Destination_Folder
Set value = string.Format("C:\Users\hm-hy\OneDrive\Dokumenter\UiPath\MoveFileAndFolders1")
Private = False
1.45 Enter Destination Folder (Assign)
To variable = Destination_Folder
Set value = string.Format(“C:\Users\hm-hy\OneDrive\Dokumenter\UiPath\MoveFileAndFolders1")
Private = False
1.26 Move all the files to new location (ForEachFileX)
In folder = string.Format(”{0}", System.IO.Directory.GetCurrentDirectory())
IncludeSubdirectories = False
Skip folders where access is denied = False
Filter = *.pdf
Order = NameAscFirst
Private = False
Body
1.27 Do (Sequence)
Private = False
Activities
1.28 Move File (MoveFile)
Path = Source1
Destination = Target1
Overwrite = True
Private = False
1.7 Move all the folders to new location (ForEachFolderX)
In folder = System.IO.Path.GetFullPath(Source_Folder)
Include subfolders = False
Skip folders where access is denied = False
Order by = NameAscFirst
Private = False
Body
1.8 Do (Sequence)
Private = False
Activities
1.9 Move Folder (MoveFolderX)
From = CurrentFolder.FullName
To = System.IO.Path.GetFullPath(Destination_Folder)
Overwrite = False
Private = False