uncia
uncia

Reputation: 604

StorageFile saving in Appliaction Data in Windows Universal App

I want to store storagefile instance from filepicker to be used later by saving in ApplicationData Conatiner . But all I found was serialization as only solution. can I store StorageFile object in application data efficiently?

 ApplicationDataContainer AppStorageSetting = ApplicationData.Current.LocalSettings;

 AppStorageSetting .Values["File"] = storagefile;

Upvotes: 0

Views: 83

Answers (1)

Romasz
Romasz

Reputation: 29792

In UWP the best method to remember picked StorageFiles is to use FutureAccessList or MostRecentlyUsedList. You can hold files and folders there and access them by a returned token. The advantage of this method is that it also remembers privileges.

You can store the obtained token in LocalSettings and then reuse it to access the file.

Upvotes: 4

Related Questions