Important information about the new capability of broadFileSystemAccess in UWP apps

Update: There has been a bit of misunderstanding on how this works. The broadFileSystemAccess is a restricted capability that an application could be granted, it is not an API. As a developer as well, I have to opt-in to using the capability. Any application in the store with the capability goes through extra verification by the Store team before any user gets it and the user is aware they are granting the application the permission to use the capability as well.

Users of the application can turn off this ability at any time via their Privacy settings, a dev should check that it has the permission to access files since a user can turn on / off as shown on my screenshot below.

While reporting this to Microsoft, we discovered there was a documentation bug here as well. As every developer knows, this is something that does happen and they are proactively fixing it.


Recently, I learned that an UWP app can access the entire file system i.e. the app is not restricted to use the LocalStorage or files and folders via a Picker. You can find all the info from MSDN.

The moment that I implemented the feature, it was before the October 2018 Update. I noticed that the first time that I used an hardcoded file in “C:\myAppData”, I didn’t get any message and it just worked despite that MSDN said: “On first use, the system will prompt the user to allow access”. The app is a LOB app in an environment controlled by my client outside the MS store, so I was even more glad that the app does not ask any questions until the October 2018 Update arrived…

After I installed the October 2018 Update, I realized that my app was crashing at startup. I found out that accessing my file above was crashing the app. I thought that the manifest was altered, but no. I contacted my friends at Microsoft and they confirmed me two important info:

1- The Windows dialog that is supposed to be shown the first time a file is accessed does not trigger is a *bug*.
2- Because it is a privacy issue, Microsoft decided with the October 2018 Update to set to OFF the value of the broad access file system.

I actually learned that the list of applications that can have access to the file system resides in Windows Settings > Privacy > File system:
image

Fortunately, you can guide the user and force the display of this page settings with the following call:

await Windows.System.Launcher.LaunchUriAsync(new Uri(“ms-settings:privacy-broadfilesystemaccess”));

You can call this method after you have done a file system access in a try/catch and then determine if you need to launch the settings view.

Please note that toggling the value in the Windows Settings will make your app crashes if it is running. Warn the user accordingly.

Despite all the hiccups, the capability broad file access is a great feature.

Happy coding!