Get error when get last file from folder

Hi, May I kindly know following GetFiles error when I get latest file from folder.
Please kindly help me.

ERROR “Compiler error(s) encountered processing expression “Directory.GetFiles(“C:\Users\A\OneDrive\Desktop\filpath”,”*.xlsx”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Tolist(0)".
‘Directory’ is ambiguous, imported from the namespaces or types ‘Microsoft.Graph, System.IO’. Main.xaml"

When I was running outside of the flowchart it was working.
But put subsequent into flowchart it get error.

Please kindly help me if you know! thank

Hi @kaungset

Check the Namespaces for Directory In import pane ,and it should be system.IO

I guess may be the issue namespace conflicts

1 Like

Hi,

replace “Directory” by “System.IO.Directory”

should be working :slight_smile:

3 Likes

Yah try using full qualified namespace like this
System.IO.Directory.GetFiles(“C:\Users\A\OneDrive\Desktop\filpath”,”*.xlsx”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).ToList(0).ToString

Cheers @kaungset

1 Like

Now I will try with this. Thank You So Much! @LKG

Now I will try with this. Thank You So Much! @Palaniyappan

sure
This was actually told by @LKG
if this works, kindly mark that as solution.

Cheers @kaungset

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