question

ChuckBohling-9818 avatar image
3 Votes"
ChuckBohling-9818 asked ·

Question about UWP and broadFileSystemAccess

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?





windows-uwp
· 2
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Do @BoreMasa's and @sgtpepper's replies help? Do you have any other questions? Please feel free to contact us.

0 Votes 0 ·

Thanks for your responses but they still doesn't answer my questions. It's true that with snip & sketch, I can't save the file c:\windows but I can to c:\windows\temp. A UWP app without broadFileSystemAccess would not be able to do that. My app with full access can do just what snip & sketch can do but it does not appear to have broadFileSystemAccess. I am running as a user with admin privileges.


Again, my question is, how does snip & sketch save to just about any folder without broadFileSystemAccess? I thought Store apps needed to be UWP and that, without special permissions, they cannot save files outside their sandbox. So, what do I need to do to get the same permissions that snip & sketch has without ask for rescap:Capability/broadFileSystemAccess?


0 Votes 0 ·
RoyLi-MSFT avatar image
0 Votes"
RoyLi-MSFT answered ·

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 .


· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

BoreMasa avatar image
0 Votes"
BoreMasa answered ·

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 ;)

· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

sgtpepper avatar image
1 Vote"
sgtpepper answered ·

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.

· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ChuckBohling-9818 avatar image
0 Votes"
ChuckBohling-9818 answered ·

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.

· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.