Bagikan melalui


FileRevocationManager.CopyProtectionAsync(IStorageItem, IStorageItem) Metode

Definisi

Catatan

Mulai Juli 2022, Microsoft menghentikan Windows Information Protection (WIP) dan API yang mendukung WIP. Microsoft akan terus mendukung WIP pada versi Windows yang didukung. Versi baru Windows tidak akan menyertakan kemampuan baru untuk WIP, dan tidak akan didukung di versi Windows yang akan datang. Untuk informasi selengkapnya, lihat Mengumumkan matahari terbenam Windows Information Protection.

Untuk kebutuhan perlindungan data Anda, Microsoft menyarankan agar Anda menggunakan Perlindungan Informasi Microsoft Purview dan Pencegahan Kehilangan Data Microsoft Purview. Purview menyederhanakan pengaturan konfigurasi dan menyediakan serangkaian kemampuan tingkat lanjut.

Catatan

FileRevocationManager mungkin tidak tersedia untuk rilis setelah Windows 10. Sebagai gantinya, gunakan FileProtectionManager.

Salin status perlindungan penghapusan selektif file atau folder ke file atau folder baru.

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)

Parameter

sourceStorageItem
IStorageItem

Item sumber untuk menyalin status perlindungan penghapusan selektif.

targetStorageItem
IStorageItem

Item target untuk menyalin status perlindungan penghapusan selektif.

Mengembalikan

true jika operasi penyalinan berhasil; jika tidak salah.

Atribut

Keterangan

Jika Anda menyimpan salinan baru file sebagai hasil dari operasi "simpan sebagai", status perlindungan penghapusan selektif tidak disalin dengan file. Untuk melindungi file, Anda harus memanggil metode CopyProtectionAsync untuk menyalin status perlindungan yang ada ke file baru. Jika Anda menyalin file yang dilindungi menggunakan metode CopyAsync atau CopyAndReplaceAsync , status perlindungan penghapusan selektif disalin dengan file dan Anda tidak perlu memanggil metode 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;
}

Metode CopyProtectionAsync memerlukan akses eksklusif ke file atau folder yang sedang dienkripsi, dan akan gagal jika proses lain yang digunakan memiliki handel yang terbuka ke file atau folder.

Berlaku untuk

Lihat juga