Hi @zev young ,
Welcome to Microsoft Q&A!
Error code 5 (ERROR_ACCESS_DENIED), it appears when the user does not have sufficient permission to access the requested file or location. UWP runs in a sandbox and cannot directly access files like desktop applications.
CreateFileW()
only support desktop apps, it's not supported in UWP. If you want to create file in UWP, you can use Windows.Storage.StorageFolder.CreateFileAsync. For more information you can refer to the document Create, write, and read a file.
If you want to access files outside the UWP application, you need to use Filepicker or open file access permissions. Please note that after using the broadFileSystemAccess
capability, users need to manually open the permission in the App setting.
Thank you.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.