Error in 'Assign' activity

Hi All,

After updating to Windows compatibility, I’m getting the following error message for ‘Assign’ activity: ‘Assign name of downloaded file to variable: Expression Activity type ‘VisualBasicValue`1’ requires compilation in order to run. Please ensure that the workflow has been compiled.’

The error refers to the following expression that worked properly under Windows (Legacy) compatibility:
String.Join(“”, Directory.GetFiles("C:\Users\grabskik\Downloads",”*.xlsx”,SearchOption.AllDirectories).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Take(1) )

Could you please suggest what the correct expression should be?

Thank you in advance,
Kaz

Kindly note:

Directory.GetFiles("C:\Users\grabskik\Downloads",”*.xlsx”,SearchOption.AllDirectories).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Take(1) 

is returning a string / the fullFilePath, so the cardinality is 1 and not a collection. The usage of String.Join is not needed or bring it e.g. with { } to a collection

We saw a lot of reports of this within this setup. Ensure that not copy paste issues is occuring on the quotes and no ” or other quotes instead of "is used. Try again when the corrections were done

HI @kgkorespondencja

Check out this thread

Regards
Gokul

Directory.GetFiles(“C:\Users\grabskik\Downloads”,”*.xlsx”,SearchOption.AllDirectories).OrderByDescending(Function(d) New FileInfo(d).CreationTime).First()

Thank you for your suggestions. Please let me test them.

Solution provided by @Gangadhar_Athili is the solution I was looking for.

Thank you @Gangadhar_Athili - it works!

1 Like

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