0

In my windows8.1 app, I have some logs and I want to read them by time, I had code below

List<string> fileFilter = new List<string>();
        fileFilter.Add(".ERROR");
        StorageFolder folder = ApplicationData.Current.LocalFolder;
        QueryOptions queryOptions = new QueryOptions(CommonFileQuery.OrderBySearchRank, fileFilter);
        var query = folder.CreateFileQueryWithOptions(queryOptions);
        IReadOnlyList<StorageFile> filteredFiles = await query.GetFilesAsync();
        if(filteredFiles.Count > 0)
        {
            err = filteredFiles[0].ToString();
        }
        return err;

However, new QueryOptions(CommonFileQuery.OrderBySearchRank, fileFilter); gives an not implemented exception. Is there any solution?

litaoshen
  • 1,762
  • 1
  • 20
  • 36

1 Answers1

0

You need to get all the files using GetFilesAsync() on the folder and sort them by yourself.

Igor Kulman
  • 16,211
  • 10
  • 57
  • 118