I wan to get the latest modified file from a folder on sharepoint, but I don’t know the name of the file.
the story:
Person A uploades a file on a folder every month, and person B have to download that file.
There are 20 people like person A, they will upload to their own folder and I have to get into every folder and get the latest version.
I know how to get into every folder, but how to get the latest file in every folder, without knowing the file name, that’s the tricky part.
Hi, you can get a list of files for each folder using Directory.GetFiles(strYourFolderPath) and then loop the files using Directory.GetLastWriteTime(strYourFilePath). This returns a date object that indicates the last time the file was modified. You just need to find which file has the most recent date.