UWP访问被拒绝 [英] UWP access denied

查看:122
本文介绍了UWP访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,要通过UWP应用打开文本文件非常困难.我已将应用程序权限设置为能够访问我的文档"中的文件以及已知库(如我的图片")的其他选项,但任何尝试打开不在这些位置的文件的尝试均会遇到访问被拒绝"错误.从拖网开始,我知道这是一个已知问题,已经被问过几次了,但是所有线程似乎都得出了这样的结论:您无法访问这些文件,除非让用户通过文件选择器访问它(由于沙箱操作) ).例如,请参见下面的线程:

Basically, I am having huge difficulty getting a text file to open by my UWP app. I have set the app permissions to be able to access files in 'my documents' and other options of known libraries like 'my pictures' but any attempt to open a file not located in these places is met by an 'Access Denied' error. From trawling the internet I know this is a known issue and has been asked a few times, but all threads seem to lead to the conclusion that you simply cannot access these files without getting the user to access it via the file picker (due to sandboxing). See thread below for example:

我知道再次问同样的问题,希望得到不同的回答听起来是徒劳的,但我知道,这不可能是全部答案.我知道这是因为我已经从商店下载了其他记事本应用程序(例如现代记事本),并且它们允许这种行为没有问题.他们如何做到的??

I know asking the same question again and hoping for a different response sounds futile but I know for a fact that this cannot be the whole answer. I know this because I have downloaded other notepad apps from the store (e.g. modern notepad) and they allow this behaviour with no issues. How are they doing this???

这已经使我发疯了几个月,我真的希望有人能帮忙

This has been driving me mad for months and I really hope someone can help

推荐答案

5个月后...

看来Microsoft现在已经添加了该功能. 只需将"broadFileSystemAccess"功能添加到应用清单中,如下所述: https://docs.microsoft.com/zh-我们/windows/uwp/files/file-access-permissions

It appears Microsoft have now added the capability. Simply add the 'broadFileSystemAccess' capability to the app manifest as described here: https://docs.microsoft.com/en-us/windows/uwp/files/file-access-permissions

请注意,在某种程度上,这仍然需要用户输入(用户必须在首次运行该应用程序时授予对文件系统访问的权限),但是不需要文件/文件夹选择器UI.

Note that this still requires user input to some extent (the user must grant permission to file system access on first run of the app) but that the file/folder picker UI is not needed.

我实际上还没有尝试过,但这听起来应该可以完成.我希望它能帮助人们将来参考这篇文章.

I haven't actually tried this yet but it sounds like it should do the job. I hope it helps people referring to this post in the future.

这篇关于UWP访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆