FileRevocationManager.ProtectAsync(IStorageItem, String) Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
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.
Melindungi file atau folder untuk penghapusan selektif.
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)
Parameter
- storageItem
- IStorageItem
File atau folder yang akan dilindungi untuk penghapusan selektif.
- enterpriseIdentity
-
String
Platform::String
winrt::hstring
Id perusahaan tempat file atau folder dilindungi. Nilai enterpriseIdentity harus diformat sebagai Nama Domain Internasional (IDN) dan tidak boleh berisi spasi. Contohnya,contoso.com
.
Mengembalikan
Operasi asinkron yang mengambil status perlindungan penghapusan selektif untuk storageItem.
- Atribut
Keterangan
Anda dapat menggunakan metode ProtectAsync untuk melindungi file atau folder menggunakan Penghapusan Selektif. Ini mengidentifikasi file yang dilindungi untuk pengidentifikasi perusahaan Anda, seperti "example.com", seperti yang ditunjukkan dalam contoh kode sebelumnya. Jika Anda melindungi folder menggunakan metode ProtectAsync, maka semua file dalam folder tersebut mewarisi perlindungan yang sama.
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;
}
Metode ProtectAsync 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
Saran dan Komentar
https://aka.ms/ContentUserFeedback.
Segera hadir: Sepanjang tahun 2024 kami akan menghentikan penggunaan GitHub Issues sebagai mekanisme umpan balik untuk konten dan menggantinya dengan sistem umpan balik baru. Untuk mengetahui informasi selengkapnya, lihat:Kirim dan lihat umpan balik untuk