FileRevocationManager.ProtectAsync(IStorageItem, String) 메서드

정의

참고

2022년 7월부터 Microsoft는 WIP(Windows Information Protection) 및 WIP를 지원하는 API를 더 이상 사용하지 않습니다. Microsoft는 지원되는 Windows 버전에서 WIP를 계속 지원할 것입니다. 새 버전의 Windows는 WIP에 대한 새로운 기능을 포함하지 않으며 이후 버전의 Windows에서는 지원되지 않습니다. 자세한 내용은 Windows Information Protection 일몰 발표를 참조하세요.

데이터 보호 요구 사항에 따라 Microsoft Purview Information ProtectionMicrosoft Purview 데이터 손실 방지 사용하는 것이 좋습니다. Purview는 구성 설정을 간소화하고 고급 기능 집합을 제공합니다.

참고

FileRevocationManager는 Windows 10 후 릴리스에 사용할 수 없습니다. 대신 FileProtectionManager를 사용합니다.

선택적 초기화를 위해 파일 또는 폴더를 보호합니다.

public:
 static IAsyncOperation<FileProtectionStatus> ^ ProtectAsync(IStorageItem ^ storageItem, Platform::String ^ enterpriseIdentity);
/// [Windows.Foundation.Metadata.Deprecated("FileRevocationManager might be unavailable after Windows 10. Instead, use FileProtectionManager.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.Security.EnterpriseData.EnterpriseDataContract)]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<FileProtectionStatus> ProtectAsync(IStorageItem const& storageItem, winrt::hstring const& enterpriseIdentity);
/// [Windows.Foundation.Metadata.RemoteAsync]
/// [Windows.Foundation.Metadata.Deprecated("FileRevocationManager might be unavailable after Windows 10. Instead, use FileProtectionManager.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Security.EnterpriseData.EnterpriseDataContract")]
 static IAsyncOperation<FileProtectionStatus> ProtectAsync(IStorageItem const& storageItem, winrt::hstring const& enterpriseIdentity);
[Windows.Foundation.Metadata.Deprecated("FileRevocationManager might be unavailable after Windows 10. Instead, use FileProtectionManager.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.Security.EnterpriseData.EnterpriseDataContract))]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<FileProtectionStatus> ProtectAsync(IStorageItem storageItem, string enterpriseIdentity);
[Windows.Foundation.Metadata.RemoteAsync]
[Windows.Foundation.Metadata.Deprecated("FileRevocationManager might be unavailable after Windows 10. Instead, use FileProtectionManager.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Security.EnterpriseData.EnterpriseDataContract")]
public static IAsyncOperation<FileProtectionStatus> ProtectAsync(IStorageItem storageItem, string enterpriseIdentity);
function protectAsync(storageItem, enterpriseIdentity)
Public Shared Function ProtectAsync (storageItem As IStorageItem, enterpriseIdentity As String) As IAsyncOperation(Of FileProtectionStatus)

매개 변수

storageItem
IStorageItem

선택적 초기화를 위해 보호할 파일 또는 폴더입니다.

enterpriseIdentity
String

Platform::String

winrt::hstring

파일 또는 폴더가 보호되는 엔터프라이즈 ID입니다. enterpriseIdentity 값은 IDN(Internationalized Domain Name)으로 서식을 지정해야 하며 공백을 포함할 수 없습니다. 예: contoso.com.

반환

storageItem에 대한 선택적 초기화 보호 상태 검색하는 비동기 작업입니다.

특성

설명

ProtectAsync 메서드를 사용하여 선택적 초기화를 사용하여 파일 또는 폴더를 보호할 수 있습니다. 이전 코드 예제와 같이 "example.com"과 같은 엔터프라이즈 식별자에 대해 보호된 파일로 식별됩니다. ProtectAsync 메서드를 사용하여 폴더를 보호하는 경우 해당 폴더의 모든 파일은 동일한 보호를 상속합니다.

ApplicationData appRootFolder = ApplicationData.Current;
string enterpriseIdentity = "example.com";
int AccessDeniedHResult = -2147024891;  // Access Denied (0x80070005)
// Add a folder and protect it using Selective Wipe.
private async Task<StorageFolder> AddFolder(string folderName)
{
    StorageFolder newFolder = await appRootFolder.LocalFolder.CreateFolderAsync(folderName);

    var status = await ProtectItem(newFolder, enterpriseIdentity);

    return newFolder;
}

// Add a file and protect it using Selective Wipe.
private async Task<StorageFile> AddFile(string fileName, StorageFolder folder)
{
    StorageFile newFile = await folder.CreateFileAsync(fileName);

    var status = 
        await Windows.Security.EnterpriseData.FileRevocationManager.
            GetStatusAsync(newFile);

    if (status != Windows.Security.EnterpriseData.FileProtectionStatus.Protected)
    {
        status = await ProtectItem(newFile, enterpriseIdentity);
    }

    return newFile;
}

private async Task<Windows.Security.EnterpriseData.FileProtectionStatus> 
    ProtectItem(IStorageItem item, string enterpriseIdentity)
{
    var status = 
        await Windows.Security.EnterpriseData.FileRevocationManager.
            ProtectAsync(item, enterpriseIdentity);

    return status;
}

ProtectAsync 메서드는 암호화되는 파일 또는 폴더에 대한 단독 액세스 권한이 필요하며 다른 프로세스에서 사용하는 경우 파일 또는 폴더에 열려 있는 핸들이 있는 경우 실패합니다.

적용 대상

추가 정보