Q:

How to retrieve the lastest file stored on local disk in UWP

I am trying to retrieve the latest file that is stored in my picture library in my UWP application. I know how to retrieve the file by name... however, I would like the retrieve it by the date/time, which is the latest file. 
How can I change the following codes?
StorageFolder picturesFolder = KnownFolders.PicturesLibrary;
string name = "Photo.jpg";
var manifestFile = await picturesFolder.GetFileAsync(name);

A:

You need to access GetBasicPropertiesAsync method for different properties
In your case, DateModified
var files = await folder.GetFilesAsync();
StorageFile lastModifiedFile = null;
DateTimeOffset lastDate = DateTimeOffset.MinValue;
foreach(var file in files) 
{
    var basicProperties = await file.GetBasicPropertiesAsync();
    var date = basicProperties.DateModified;
    if(date > lastDate) 
    {
      lastDate = date;
      lastModifiedFile = file;
    }
}

lastModifiedFile is one you need now.

