Can't figure out my assign variable error

I’m using an assign activity to pull the most recent downloaded file. i’m using the below expression:

i’m getting the below error: System.NotSupportedException: Expression Activity type ‘VisualBasicValue`1’ requires compilation in order to run. Please ensure that the workflow has been compiled. at System.Activities.Expressions.CompiledExpressionInvoker.InvokeExpression(ActivityContext activityContext)

Can you determine what i’m doing wrong? i got this code off of the forum to use. i looked at another post and it stated something about the use of double quotes but i cannot determine my error here.

@chris.dease Please rewrite the quotes after the text ‘whatsapp’

1 Like

Hi @chris.dease

There is a problem in the double quotes in your expression, in expressions in UiPath we use this type of double quotes (“”), if we use this type ( ‟ ”) it will throw this error. Your expression is quite good but change the double quotes with this " only. It will solve your issue.

If your will not work after changing double quotes, use the below one,

Directory.GetFiles(@"C:\Users\" + Environment.UserName + @"\Downloads\whatsapp", "*.xlsx")
    .OrderByDescending(d => new FileInfo(d).CreationTime)
    .ToList(0)

Hope it helps!!

This worked. Just for reference here, i had to remove the “whatsapp” on my file path as i received the error “could not find file path.” Once i removed i was able to import the file. Thanks for the help!

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