StorageApplicationPermissions
StorageApplicationPermissions
StorageApplicationPermissions
StorageApplicationPermissions
Class
Definition
Provides static properties for you to get your app's most recently used list (MRU) (use StorageApplicationPermissions.MostRecentlyUsedList ) and future-access list (use StorageApplicationPermissions.FutureAccessList.
public : static class StorageApplicationPermissionspublic static class StorageApplicationPermissionsPublic Static Class StorageApplicationPermissions// You can use this class in JavaScript.
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Examples
This example demonstrates how to add an item to the app's FutureAccessList and MostRecentlyUsedList.
StorageFile file = await savePicker.PickSaveFileAsync();
if (file != null)
{
// Add to MRU with metadata (For example, a string that represents the date)
string mruToken = Windows.Storage.AccessCache.StorageApplicationPermissions.MostRecentlyUsedList.Add(file, "20120716");
// Add to FA without metadata
string faToken = Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList.Add(file);
}
else
{
// The file picker was dismissed with no file selected to save
}
savePicker.pickSaveFileAsync().then(function (file) {
if (file) {
// Add to MRU with metadata (For example, a string that represents the date)
var mruToken = StorageApplicationPermissions.mostRecentlyUsedList.add(file, "20120716");
// Add to FA without metadata
var faToken = Windows.Storage.AccessCache.StorageApplicationPermissions.futureAccessList.add(file);
} else {
// The file picker was dismissed with no file selected to save
}
});
It is recommended that you store the tokens returned by StorageApplicationPermissions.MostRecentlyUsedList.Add and StorageApplicationPermissions.FutureAccessList.Add so that you can use them to retrieve the respective list entry for the item that you added. In the example, we store the tokens in mruToken and faToken respectively but we don't do anything else with them.
Additionally, the savePicker variable in the example contains a FileSavePicker object that was created by the sample. To learn more about saving files with file picker, see How to save files through . To learn about accessing files, see Quickstart: Accessing files with .
Remarks
Access the methods and properties of this class statically.
To see more code examples, see the File picker sample and the File access sample.
To learn about using the FutureAccessList and MostRecentlyUsedList, see How to track recently used files and folders.
To learn about what files and locations your app has permission to access, see File access permissions.
Properties
FutureAccessList FutureAccessList FutureAccessList FutureAccessList
Gets an object that represents a list that an app maintains so that the app can store files and/or locations (like folders) and easily access these items in the future.
public : static StorageItemAccessList FutureAccessList { get; }public static StorageItemAccessList FutureAccessList { get; }Public Static ReadOnly Property FutureAccessList As StorageItemAccessList// You can use this property in JavaScript.
The future-access list object.
MostRecentlyUsedList MostRecentlyUsedList MostRecentlyUsedList MostRecentlyUsedList
Gets an object that represents a list that an app can use to track the files and/or locations (like folders) that the app has accessed most recently.
public : static StorageItemMostRecentlyUsedList MostRecentlyUsedList { get; }public static StorageItemMostRecentlyUsedList MostRecentlyUsedList { get; }Public Static ReadOnly Property MostRecentlyUsedList As StorageItemMostRecentlyUsedList// You can use this property in JavaScript.
- Value
- StorageItemMostRecentlyUsedList StorageItemMostRecentlyUsedList StorageItemMostRecentlyUsedList StorageItemMostRecentlyUsedList
The most recently used (MRU) list object.
Remarks
If you want to respond to StorageItemMostRecentlyUsedList.@Windows.Storage.AccessCache.StorageItemMostRecentlyUsedList.ItemRemoved?text=ItemRemoved events you must register your event handle every time you get a new reference to the StorageItemMostRecentlyUsedList.