Directory.GetFiles error

Hi all

I was using this fuction to get the latest downloaded file - Directory.GetFiles(“C:\Users\User\Downloads”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Tolist(0)

It was working fine until I downloaded the Microsoft 365 package (not sure if that’s related somehow haha but it’s an odd coincidence), now I’m getting this error:

Does anyone know how to fix this please? Or know of a different way to get the latest file downloaded?

Thanks :slight_smile:

Hi,

Can you try to add System.IO. as the following?

 System.IO.Directory.GetFiles

Regards,

1 Like

Thank you so much!

1 Like

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