Represents a list that an app can use to track the files and/or locations (like folders) that the app has accessed most recently. Files and locations are stored in this most recently used (MRU) list are represented by StorageFile and StorageFolder objects, respectively.
Syntax
Public NotInheritable Class StorageItemMostRecentlyUsedList Inherits Object Implements IStorageItemAccessList
Attributes
- VersionAttribute(NTDDI_WIN8)
Members
The StorageItemMostRecentlyUsedList class has these types of members:
Events
The StorageItemMostRecentlyUsedList class has these events.
| Event | Description |
|---|---|
| ItemRemoved | Fires when a storage item is removed from the most recently used (MRU) list. |
Methods
The StorageItemMostRecentlyUsedList class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.
| Method | Description |
|---|---|
| Add(IStorageItem) | Adds a new storage item to the most recently used (MRU) list. |
| Add(IStorageItem, String) | Adds a new storage item and accompanying metadata to the most recently used (MRU) list. |
| AddOrReplace(String, IStorageItem) | Adds a new storage item to the most recently used (MRU) list, or replaces the specified item if it already exists in the list. |
| AddOrReplace(String, IStorageItem, String) | Adds a new storage item and accompanying metadata to the most recently used (MRU) list, or replaces the specified item if it already exists in the list. |
| CheckAccess | Determines whether the app has access to the specified storage item in the most recently used (MRU) list. |
| Clear | Removes all storage items from the most recently used (MRU) list. |
| ContainsItem | Determines whether the most recently used (MRU) list contains the specified storage item. |
| GetFileAsync(String) | Retrieves the specified storageFile from the most recently used (MRU) list. |
| GetFileAsync(String, AccessCacheOptions) | Retrieves the specified storageFile from the most recently used (MRU) list using the specified options. |
| GetFolderAsync(String) | Retrieves the specified StorageFolder from the most recently used (MRU) list. |
| GetFolderAsync(String, AccessCacheOptions) | Retrieves the specified StorageFolder from the most recently used (MRU) list using the specified options. |
| GetItemAsync(String) | Retrieves the specified item (like a file or folder) from the most recently used (MRU) list. |
| GetItemAsync(String, AccessCacheOptions) | Retrieves the specified item (like a file or folder) from the most recently used (MRU) list using the specified options. |
| Remove | Removes the specified storage item from the most recently used (MRU) list. |
Properties
The StorageItemMostRecentlyUsedList class has these properties.
| Property | Access type | Description |
|---|---|---|
| Read-only | Gets an object for retrieving storage items from the most recently used (MRU) list. | |
| Read-only | Gets the maximum number of storage items that the most recently used (MRU) list can contain. |
Remarks
Use the MRU list to track files and/or locations that your user accesses frequently.
This list can store up to 25 items. While the app must add items to the MRU in order to track them, Windows maintains the 25-item limit by removing stale items if necessary.
Note If you want to respond to ItemRemoved events you must register your event handle every time you get a new reference to the StorageItemMostRecentlyUsedList.
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 more about what files and locations your app has permission to access, see File access and permissions in Windows Store apps.
Examples
This example demonstrates how to add an item to the app's FutureAccessList and MostRecentlyUsedList.
We recommend that you store the tokens that are 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 pickers, see How to save files through file pickers. To learn about accessing files, see Quickstart: Accessing files with file pickers.
Requirements
|
Minimum supported client | Windows 8 [Windows Store apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps only] |
|
Namespace |
|
|
Metadata |
|
See also
Build date: 12/4/2012