Exception of Unauthorized while using MostRecently

2019-03-06 03:38发布

问题:

I am working with Store apps using C#. I am using StorageApplicationPermissions.MostRecentlyUsedList to load Local Epub files. After getting those file as a Storage file.

string EpubPathToken= Windows.Storage.AccessCache.StorageApplicationPermissions.MostRecentlyUsedList.Add(file);
StorageFile file = await StorageApplicationPermissions.FutureAccessList.GetFileAsync(EpubPathToken);
Extraction(file);

While Extracting the Epub file as Zip to Package folder using ApplicationData I am getting an Exeption of Unauthorized.

Here's screen shot of error

Why because If I use the same code using from KnownFolders like Pictures Library the Extraction is working Fine.

Can any one give me any idea about this ?

回答1:

Finally I solved the issue of getting exception of Unauthorized With the use of Blog

I changed the code snippet according to my requirement.

The source of code describes writes bytes of file in ZipArchiveEntry, hence I used a helper method GetByteFromFile(), which takes StorageFile object and returns me byte[] array.

Finally thanks to Xyroid