broadFileSystemAccess UWP

Sar*_*mar 2 microsoft-metro windows-runtime uwp uwp-xaml

我正在尝试将broadFileSystemAccess功能用于UWP应用程序,但broadFileSystemAccess功能未列在Package.appxmanifest的功能列表中.

我的最小和最大目标版本是1803,建立17134,请帮助我.

Mar*_*und 9

此功能未在Package.appxmanifest的"设计器"中列出,您必须通过代码手动添加它.

转到解决方案资源管理器,右键单击Package.appxmanifest.选择查看代码.

在代码视图中,更新Package元素以包含以下内容:

<Package
  ...
  xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
  IgnorableNamespaces="uap mp rescap">
Run Code Online (Sandbox Code Playgroud)

不要复制IgnorableNamespaces属性,只是附加rescap到其值的末尾.现在向下滚动并找到<Capabilities>.内部添加broadFileSystemAccess功能如下:

<rescap:Capability Name="broadFileSystemAccess" />
Run Code Online (Sandbox Code Playgroud)

  • 我真的不明白为什么会存在这些愚蠢的例外。到底为什么 GUI 中存在一些功能,而其他一些功能必须通过代码手动添加?该死。 (7认同)
  • 很抱歉没有注意到您的问题。您可以将 StorageFilder.CreateFileQueryWithOptions 与 QueryOptions 实例一起使用来进行搜索。您可以配置很多属性。https://docs.microsoft.com/en-us/uwp/api/windows.storage.storagefolder.createfilequerywithoptions (2认同)
  • 你是如何尝试访问这些文件的?您必须实际使用 StorageFile API,而不仅仅是经典的 System.IO API (2认同)
  • 这个答案似乎并不像写的那样有效。我已完全按照答案中的步骤进行操作,但无法使用“await Windows.Storage.StorageFolder.GetFolderFromPathAsync("C:\\Users\\user name")”,而不会抛出“E_ACCESSDENIED”。 (2认同)