How to enable DocumentsLibrary capability in a Windows store (WinRT) app?

本秂侑毒 提交于 2019-12-01 05:13:59

Looks like your answer is here. The author shows it available in VS2012, but gone from the list in VS2013, citing MS policy against accessing that particular folder.

[Although] this capability is gone just from the UI, you still can open appxmanifest source and manually add the capability. The result will probably be the same as before – failure of certification for individual developers, so you better stay away from this trick. Microsoft strongly recommend against using Documents Library capability, suggesting Folder and File Pickers instead.

As per Grant's answer, a way around this is to add the Capability manually.

Right-click the Package.appxmanifest file in Solution Explorer, and select "View code", then either find the Capabilities element, or add it yourself:

...
  <Capabilities>
    <Capability Name="internetClient" />
    <Capability Name="removableStorage" />
    <Capability Name="documentsLibrary" />
  </Capabilities>
</Package>

Here's what you'll get from the Windows Store when you try to publish it

As this is UAP the syntax needs to state this, should be as followed

  <Capabilities>
    <Capability Name="internetClient" />
    <uap:Capability Name="documentsLibrary" />
  </Capabilities>

You need to add 'uap:' in front of Capability

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!