Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

StorageItemAccessList class

Applies to Windows and Windows Phone

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. Files and locations are stored in this future-access list are represented by StorageFile and StorageFolder objects, respectively.

Syntax


public sealed class StorageItemAccessList : IStorageItemAccessList

Attributes

[Version(0x06020000)]

Members

The StorageItemAccessList class has these types of members:

Methods

The StorageItemAccessList class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
Add(IStorageItem) Adds a new storage item to the access list.
Add(IStorageItem, String) Adds a new storage item and accompanying metadata to the access list.
AddOrReplace(String, IStorageItem) Adds a new storage item to the access 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 access 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 access list.
Clear Removes all storage items from the access list.
ContainsItem Determines whether the access list contains the specified storage item.
GetFileAsync(String) Retrieves the specified StorageFile from the list.
GetFileAsync(String, AccessCacheOptions) Retrieves the StorageFile from the list using the specified options.
GetFolderAsync(String) Retrieves the specified StorageFolder from the list.
GetFolderAsync(String, AccessCacheOptions) Retrieves the specified StorageFolder from the 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 list using the specified options.
Remove Removes the specified storage item from the access list.

 

Properties

The StorageItemAccessList class has these properties.

PropertyAccess typeDescription

Entries

Read-onlyGets an object for retrieving storage items from the access list.

MaximumItemsAllowed

Read-onlyGets the maximum number of storage items that the access list can contain.

 

Remarks

Use this future-access list to preserve access to files and locations that may not be included with the accessible locations specified by the capabilities in your app manifest. For example, if your app uses a file picker to access a file (or location), we recommend that you store the StorageFile that is returned from the file picker in this future-access list.

This list can store up to 1000 items and must be maintained by the app.

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.


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
}

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]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Storage.AccessCache
Windows::Storage::AccessCache [C++]

Metadata

Windows.winmd

See also

StorageApplicationPermissions.futureAccessList

 

 

Show:
© 2014 Microsoft