Sharath H G
Sharath H G

Reputation: 1

Access is denied. Exception from HRESULT: 0x80070005 (E_ACCESSDENIED) in UWP app

GitHub Link for the project

private async void myBtn_Click(object sender, RoutedEventArgs e)
{
    // Specify the folder path
    string folderPath = @"C:\\RGNEW";
    
    // Get the StorageFolder from the path
    StorageFolder folder = StorageFolder.GetFolderFromPathAsync(folderPath).AsTask().Result;
    
    // Add the folder to FutureAccessList with the folder path as the token
    string token = folderPath; // You can customize the token if needed
    StorageApplicationPermissions.FutureAccessList.AddOrReplace(token, folder);
}

Encountering Access is denied. Exception from HRESULT: 0x80070005 (E_ACCESSDENIED) error
in UWP app when attempting direct folder creation and file read/write on the C:\ drive.

The project has the **broadFileSystemAccess **capability, and I have enabled file access in both the file system settings for the app and through right-clicking on the app and selecting app settings.

Despite these configurations, the issue persists. Seeking guidance on resolving permissions issues and exploring alternatives to enable direct folder creation without relying on user selection. Any insights or solutions would be greatly appreciated!

Upvotes: 0

Views: 200

Answers (0)

Related Questions