Question about UWP and broadFileSystemAccess

Chuck Bohling 346 Reputation points
2020-02-23T01:27:39.43+00:00

I have a UWP app that needs full access to the filesystem. Basically, I need to be able to access any file or folder that a user can access with Explorer. To do this, I set <rescap:Capability Name="broadFileSystemAccess"/>. The app's been accepted and is now published in the store. Its store details show that its permissions include full filesystem access. Everything works fine.

My questions:

  • Why are there Microsoft and non-Microsoft store apps that have full access but do not show that permission in their store details?
  • Once installed, why does settings for those apps not show the "App Permissions/File System" toggle yet they have full access? My settings page has it. If I disable it, my app doesn't work very well.

As an example, take Microsoft's "Snip & Sketch". It's in the store but apparently does not request rescap:Capability/broadFileSystemAccess. Yet I can do a snip and save the result in any folder.

The reason I ask it that to deliberately and visibly ask for full access can be a bit scary for a user. What would be much nicer would be to have default file access like Snip & Sketch, and any other desktop app. So, how do these app get broadFileSystemAccess?

Universal Windows Platform (UWP)
{count} votes

Accepted answer
  1. Roy Li - MSFT 32,721 Reputation points Microsoft Vendor
    2020-02-27T06:03:30.917+00:00

    Hello,

    Welcome to Microsoft Q&A!

    Well, I understand your question. The broadFileSystemAccess could let you access to all files that the user has access to. But it doesn't mean that your app has the admin privileges like your account. When you go the C:\windows\temp in the file explorer, it will ask you to run as admin.

    And second, yes, the Store apps needed to be UWP apps. But the snip & sketch app is using FileSavePicker, you could also use FileSavePicker in your app and you could get the same behavior with snip & sketch. Please refer to this document: Save a file with a picker .

    1 person found this answer helpful.
    0 comments No comments

4 additional answers

Sort by: Most helpful
  1. 2020-02-23T14:24:05.417+00:00

    I can do a snip and save the result in any folder.

    Snip and sketch is not using broadfilesystemaccess permission. It is the User, not the app who is saving the file with a filesavepicker. You need such a permission if your your app needs to access a file/folder other than library folders without asking the user to choose it for you like a filemanager.

    1 person found this answer helpful.
    0 comments No comments

  2. BoreMasa 6 Reputation points
    2020-02-23T05:48:18.177+00:00

    Hello.

    I think "Snip & Sketch" got just user rights who use it. If u try save "Snip & Sketch" photo to c:\windows..... you got box inform you don't have permission ... Contact the admin pla pla...

    You app access is much powerfull u see ;)

    0 comments No comments

  3. Chuck Bohling 346 Reputation points
    2020-03-09T02:15:20.797+00:00

    Thanks. I implemented the sample code and it works. I can select a file in c:/windows/temp and it's successfully written. Trying to write to c:/windows fails as it should. So, as far as my questions are concerned, they are answered. Unfortunately, my problem is not solved. I'm going to do some more research and, if necessary, I'll start a new question/conversation.

    Just for your information, I can't use FileSavePicker to choose the output file. What my app does is to allow drag and drop of 1 or more files select by Explorer. After the drop, each file is read, processed then a new file, in the same directory as the input file, is written. So, by design, once the drag and drop happens, there can be no more dialogs (e.g. FileSavePicker). To create the output file, I use calls like StorageFolder.GetFolderFromPathAsync, GetItemAsync, and GetParentAsync. Even if the output directory is c:/windows/temp, those calls will fail unless I have broadFileSystemAccess.


  4. Chuck Bohling 346 Reputation points
    2022-01-05T00:04:54.047+00:00

    I abandoned UWP and switched to WPF. I packaged the app as MSIX for submission to the store. My app is desktop only, so this worked ok for me. I found UWP too restrictive and difficult to use for a desktop app. MSIX has some restrictions but they're fairly minor in my case.

    0 comments No comments