Get the earliest file from the sharepoint


In Sharepoint, I’ve some folders in that folders it has some files, how to get the earliest file in sharepoint

String.Join("", Directory.GetFiles(FolderPath,"*.xlsx",SearchOption.AllDirectories).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Take(1) )

I’ve used thiscondition to get the earliest file, but I’m facing this error message:
“The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.”
without using long path file, how to overcome this error and need to get the earliest file.

Could anyone help me on this

Thanks in advance

1 Like

Could you please show the path ?


Hi Nithin,
Please find the attachment below, due to some security purpose I’m not able to share the domain name Documents/Forms/AllItems.aspx?id=/sites/JournalEntrySupport/Shared Documents/
To be Entered&viewid=5b786c5f-c0e3-4211-93e2-db60c4075e6a

1 Like

Okay so is this mapped to your local as well ?

No, that is in client VM