FileProtectionManager.ProtectAsync(IStorageItem, String) Method

Definition

Note

Starting in July 2022, Microsoft is deprecating Windows Information Protection (WIP) and the APIs that support WIP. Microsoft will continue to support WIP on supported versions of Windows. New versions of Windows won't include new capabilities for WIP, and it won't be supported in future versions of Windows. For more information, see Announcing sunset of Windows Information Protection.

For your data protection needs, Microsoft recommends that you use Microsoft Purview Information Protection and Microsoft Purview Data Loss Prevention. Purview simplifies the configuration set-up and provides an advanced set of capabilities.

Protect the data in a file to an enterprise identity. The app can then use standard API to read or write from the file.

public:
 static IAsyncOperation<FileProtectionInfo ^> ^ ProtectAsync(IStorageItem ^ target, Platform::String ^ identity);
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<FileProtectionInfo> ProtectAsync(IStorageItem const& target, winrt::hstring const& identity);
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<FileProtectionInfo> ProtectAsync(IStorageItem target, string identity);
function protectAsync(target, identity)
Public Shared Function ProtectAsync (target As IStorageItem, identity As String) As IAsyncOperation(Of FileProtectionInfo)

Parameters

target
IStorageItem

The file to be protected.

identity
String

Platform::String

winrt::hstring

The enterprise identity. This is an email address or domain that is managed. Use ProtectionPolicyManager.IsIdentityManaged to confirm that an email address or domain is managed before using the identity to protect a file.

Returns

When the call to this method completes successfully, it returns a FileProtectionInfo object that contains the status of the newly protected file.

Attributes

Windows requirements

App capabilities
enterpriseDataPolicy

Applies to

See also