StorageApplicationPermissions 클래스

정의

앱의 가장 최근에 사용한 목록(MRU)( StorageApplicationPermissions.MostRecentlyUsedList 사용) 및 미래 액세스 목록( StorageApplicationPermissions.FutureAccessList 사용)을 가져올 수 있는 정적 속성을 제공합니다.

public ref class StorageApplicationPermissions abstract sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
class StorageApplicationPermissions final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public static class StorageApplicationPermissions
Public Class StorageApplicationPermissions
상속
Object Platform::Object IInspectable StorageApplicationPermissions
특성

Windows 요구 사항

디바이스 패밀리
Windows 10 (10.0.10240.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)

예제

이 예제에서는 앱의 FutureAccessListMostRecentlyUsedList에 항목을 추가하는 방법을 보여 줍니다.

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
}
#include <sstream>
#include <winrt/Windows.Storage.h>
#include <winrt/Windows.Storage.AccessCache.h>
#include <winrt/Windows.Storage.Pickers.h>
using namespace winrt;
using namespace Windows::Storage::Pickers;
using namespace Windows::Storage;
...
winrt::fire_and_forget AddToLists()
{
    FileSavePicker savePicker;
    auto plainTextExtensions{ winrt::single_threaded_vector<winrt::hstring>() };
    plainTextExtensions.Append(L".txt");
    savePicker.FileTypeChoices().Insert(L"Plain Text", plainTextExtensions);
    savePicker.SuggestedFileName(L"New Document");

    StorageFile file{ co_await savePicker.PickSaveFileAsync() };
    if (file)
    {
        // Add to MRU with metadata (For example, a string that represents the date)
        winrt::hstring mruToken { Windows::Storage::AccessCache::StorageApplicationPermissions::MostRecentlyUsedList().Add(file, L"20120716") };

        // Add to FA without metadata
        winrt::hstring faToken { Windows::Storage::AccessCache::StorageApplicationPermissions::FutureAccessList().Add(file) };
    }
    else
    {
        // The file picker was dismissed with no file selected to save
    }
}

StorageApplicationPermissions.MostRecentlyUsedList.AddStorageApplicationPermissions.FutureAccessList.Add에서 반환된 토큰을 저장하여 추가한 항목에 대한 해당 목록 항목을 검색하는 데 사용할 수 있도록 하는 것이 좋습니다. 이 예제에서는 각각 및 faTokenmruToken 토큰을 저장하지만 다른 작업은 수행하지 않습니다.

또한 예제의 savePicker 변수에는 샘플에서 만든 FileSavePicker 개체가 포함됩니다. 파일 선택기를 사용하여 파일을 저장하는 방법에 대한 자세한 내용은 선택기로 파일 저장을 참조하세요. 파일에 액세스하는 방법에 대한 자세한 내용은 선택기를 사용하여 파일 및 폴더 열기를 참조하세요.

설명

이 클래스의 메서드 및 속성에 정적으로 액세스합니다.

더 많은 코드 예제를 보려면 파일 선택기 샘플파일 액세스 샘플을 참조하세요.

FutureAccessListMostRecentlyUsedList를 사용하는 방법에 대한 자세한 내용은 최근에 사용한 파일 및 폴더 추적을 참조하세요.

앱에 액세스할 수 있는 권한이 있는 파일 및 위치에 대한 자세한 내용은 파일 액세스 권한을 참조하세요.

버전 기록

Windows 버전 SDK 버전 추가된 값
1903 18362 GetFutureAccessListForUser
1903 18362 GetMostRecentlyUsedListForUser

속성

FutureAccessList

앱이 파일 및/또는 위치(예: 폴더)를 저장하고 나중에 이러한 항목에 쉽게 액세스할 수 있도록 앱이 유지 관리하는 목록을 나타내는 개체를 가져옵니다.

MostRecentlyUsedList

앱이 가장 최근에 액세스한 파일 및/또는 위치(예: 폴더)를 추적하는 데 사용할 수 있는 목록을 나타내는 개체를 가져옵니다.

메서드

GetFutureAccessListForUser(User)

앱이 파일 및/또는 위치(예: 폴더)를 저장하고 나중에 이러한 항목에 쉽게 액세스할 수 있도록 앱이 유지 관리하는 목록을 나타내는 개체를 가져옵니다. 이 메서드는 지정된 사용자로 범위가 지정된 개체를 반환합니다. 다중 사용자 애플리케이션에 이 메서드를 사용합니다.

GetMostRecentlyUsedListForUser(User)

앱이 가장 최근에 액세스한 파일 및/또는 위치(예: 폴더)를 추적하는 데 앱이 사용할 수 있는 개체를 가져옵니다. 이 메서드는 지정된 사용자로 범위가 지정된 개체를 반환합니다. 다중 사용자 애플리케이션에 이 메서드를 사용합니다.

적용 대상