File path using iResource

File path requires me to use iResource scope. I have already declared a string path using a variable called str_path. I then declared a iResource variable called file_name with an expression New UiPath.Core.PathResource(str_path). BC30002 error was found. why?

Hi @Bella123

Can you try below for file path?

LocalResource.FromPath(str_path)

Hi @Bella123,

Welcome to the community.

Can you try the below syntax in the assign activity

file_name = New UiPath.Platform.ResourceHandling.LocalFileResource(str_path)

Let me know if this works

Thanks,
NaNi

Hi @Bella123

Welcome to UiPath,
try to use FileResource instead of PathResource.

file_res = New UiPath.Resources.FileResource(str_path)

Hi @Bella123 ,

Try using:

LocalResource.fromPath(str_path)

Regards