StorageApplicationPermissions class

Applies to Windows and Windows Phone

Provides access to lists that an app can use to track recently accessed files and/or locations or to store files and/or locations to access in the future.

Syntax


public static class StorageApplicationPermissions

Attributes

[Version(0x06020000)]

Members

The StorageApplicationPermissions class has these types of members:

Methods

The StorageApplicationPermissions class inherits methods from the Object class (C#/VB/C++).

Properties

The StorageApplicationPermissions class has these properties.

PropertyAccess typeDescription

FutureAccessList

Read-onlyGets 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.

MostRecentlyUsedList

Read-onlyGets 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.

 

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 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

 

 

Show:
© 2014 Microsoft