次の方法で共有


FileRevocationManager.CopyProtectionAsync(IStorageItem, IStorageItem) メソッド

定義

注意

2022 年 7 月以降、Microsoft は Windows Information Protection (WIP) と WIP をサポートする API を非推奨とします。 Microsoft は引き続き、サポートされているバージョンの Windows で WIP をサポートします。 Windows の新しいバージョンには WIP の新機能は含まれません。また、今後のバージョンの Windows ではサポートされません。 詳細については、「Windows Information Protectionの終了を発表する」を参照してください。

データ保護のニーズに合わせて、Microsoft Purview 情報保護Microsoft Purview データ損失防止を使用することをお勧めします。 Purview を使用すると、構成のセットアップが簡略化され、高度な機能セットが提供されます。

注意

fileRevocationManager は、Windows 10後のリリースでは使用できない場合があります。 代わりに、 FileProtectionManager を使用します

ファイルまたはフォルダーの選択的ワイプ保護状態を新しいファイルまたはフォルダーにコピーします。

public:
 static IAsyncOperation<bool> ^ CopyProtectionAsync(IStorageItem ^ sourceStorageItem, IStorageItem ^ targetStorageItem);
/// [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<bool> CopyProtectionAsync(IStorageItem const& sourceStorageItem, IStorageItem const& targetStorageItem);
/// [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<bool> CopyProtectionAsync(IStorageItem const& sourceStorageItem, IStorageItem const& targetStorageItem);
[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<bool> CopyProtectionAsync(IStorageItem sourceStorageItem, IStorageItem targetStorageItem);
[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<bool> CopyProtectionAsync(IStorageItem sourceStorageItem, IStorageItem targetStorageItem);
function copyProtectionAsync(sourceStorageItem, targetStorageItem)
Public Shared Function CopyProtectionAsync (sourceStorageItem As IStorageItem, targetStorageItem As IStorageItem) As IAsyncOperation(Of Boolean)

パラメーター

sourceStorageItem
IStorageItem

選択的ワイプ保護の状態をコピーするソース項目。

targetStorageItem
IStorageItem

選択的ワイプ保護の状態をコピーするターゲット項目。

戻り値

コピー操作が成功した場合は true。それ以外の場合は false

属性

注釈

"名前を付けて保存" 操作の結果としてファイルの新しいコピーを保存した場合、選択的ワイプ保護の状態はファイルと共にコピーされません。 ファイルを保護するには、CopyProtectionAsync メソッドを呼び出して、既存の保護状態を新しいファイルにコピーする必要があります。 CopyAsync メソッドまたは CopyAndReplaceAsync メソッドを使用して保護されたファイルをコピーすると、選択的ワイプ保護の状態がファイルと共にコピーされるため、CopyProtectionAsync メソッドを呼び出す必要はありません。

public async Task<bool> CopyFile(StorageFile file, StorageFolder newFolder) 
{
    bool result = false;

    try
    {
        var newFile = await file.CopyAsync(newFolder);
        result = await 
            Windows.Security.EnterpriseData.FileRevocationManager.
            CopyProtectionAsync(file, newFile);
        }
    catch (Exception e) 
    {
        // Handle exception. For example, copy already exists.
    }

    return result;
}

CopyProtectionAsync メソッドは、暗号化されているファイルまたはフォルダーへの排他的アクセスを必要とし、別のプロセスでを使用している場合、ファイルまたはフォルダーに対してハンドルが開いている場合は失敗します。

適用対象

こちらもご覧ください