I am developing an application that manages files. For the GUI, I am using UWP. I have enabled the capabilities for the File System (in Package.appxmanifest). I want to check if the File System on each volume in PC is NTFS.
I tried:
to call DriveFormat from DriveInfo, but there is thrown exception: System.UnauthorizedAccessException: 'Access to the path 'C:' is denied.' Why? I have enabled the capabilities for the File System.
DriveInfo[] drives = DriveInfo.GetDrives();
foreach (DriveInfo d in drives)
{
d.DriveFormat;
}
I have also run Visual Studio as administrator and the same exception is thrown.
I met a similar situation few months ago, when I needed the used space percentage on volume, and the same exception was thrown. To solve the problem with the used space in the drive, I have used StorageFolder.
const string PERCENT_FULL = "System.PercentFull";
StorageFolder storageFolder = await StorageFolder.GetFolderFromPathAsync(d.RootDirectory.FullName);
var properties = await storageFolder.Properties.RetrievePropertiesAsync(new string[] { PERCENT_FULL });
Can I check the file system type on the volume with StorageFolder? I have searched on https://learn.microsoft.com/en-us/windows/win32/properties/core-bumper to see if any property could solve my problem, but I did not find anything.
Is there any possibility to check the file system in UWP?