- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 DownloadsFolder
方法创建文件和文件夹。
我想获取父文件夹作为 StorageFolder
实例,这样我就可以列出和操作应用下载文件夹中的所有项目。
我已经从已知的 StorageFile
中尝试了 GetParentAsync()
,但返回值为空。
StorageFile sf = await DownloadsFolder.CreateFileAsync("testMarker");
StorageFolder dlFolder = await sf.GetParentAsync();
有什么方法可以编程访问这个文件夹吗?
最佳答案
您的应用似乎没有读取下载目录的权限。我们可以使用 GetParentAsync
获取应用程序对其有权限的父级,但不能获取应用程序没有权限的文件夹。
如果我们将音乐库、图片库和视频库添加到 appxmanifest 的功能中,我们可以使用 GetParentAsync
方法将父文件夹作为 StorageFolder
在这些文件夹中。
If you create a file or folder in the Downloads folder, we recommend that you add that item to your app's FutureAccessList so that your app can readily access that item in the future.
更多信息,请引用Locations Windows Store apps can access .
因此,如果你想获取 DownloadsFolder 中的其他文件夹和文件,你应该能够 Open files and folders with a picker .
关于c# - UWP c# 如何获取应用程序下载文件夹的 StorageFolder 对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42816659/
我正在对一个新的 Win8 商店应用程序进行单元测试,并注意到我想避免的竞争条件。所以我正在寻找一种方法来避免这种竞争情况。 我有一个类,当实例化时调用一个方法以确保它有一个本地 StorageFol
我正在使用 Windows Phone 8.1(RT) 应用程序,我想知道如何获取StorageFolder 中的文件数。 我知道我们可以使用 StorageFolder.GetFilesAsync(
我对 MSDN 和 SO 进行了大量研究,但似乎有很多关于这个主题的评论褒贬不一,没有直接的答案。我的 UWP 应用需要为用户下载一些项目。将其放入“下载”文件夹而不是文档或图片似乎是合乎逻辑的。 我
如果我有一个 Metro StorageFolder,我可以使用 获取文件异步(文件名)。 但是,我怎么知道文件是否首先存在?现在,我发现了一个异常,但这似乎不是正确的做法。 最佳答案 根据微软的说法
我正在尝试使数据库与 Windows 8 音乐库保持同步,但我尚未找到有效的解决方案。我知道 .NET 有一个 Windows 8 应用程序无法使用的 FileSystemWatcher。目前,我的想
在常规的 .NET Framework 中,有许多方法可以根据搜索模式检索目录中的文件子集,例如 DirectoryInfo.GetFiles(string searchPattern) . Wind
如何从用户友好的(本地化的)路径获取 StorageFolder? 文件夹可以有一个用户友好的(本地化的)名称。可以通过以下方式读取名称: StorageFolder.DisplayName 示例:文
StorageFolder.GetFilesAsync非常慢: 约 3500 个文件的文件夹需要 7 秒 回到 Windows Phone 8.0 Silverlight,我能够更快地获取 Camer
尝试在 InstalledLocation StorageFolder 中创建文件异步时访问被拒绝 StorageFolder storageFolder = Windows.ApplicationM
当在不同线程上多次调用 Windows.Storage.StorageFolder.GetFolderFromPathAsync 时,我收到 ArgumentExceptions。这是一个重现该问题的
我正在使用 DownloadsFolder 方法创建文件和文件夹。 我想获取父文件夹作为 StorageFolder 实例,这样我就可以列出和操作应用下载文件夹中的所有项目。 我已经从已知的 Stor
我有一个应用程序,我必须在其中存储和使用文件夹和文件的绝对 路径。我有一个非常简单的问题。当我像这样存储文件夹的路径:“ms-appdata:///local/my_folder”并尝试从此路径获取
这个问题在这里已经有了答案: 8 年前关闭。 Possible Duplicate: Check if a file exists in the project in WinRT 我正在使用 Stor
我想获取文件夹及其子文件夹中的所有文件。但是像这样的平面查询: var allFiles = await myFolder.GetFilesAsync(Windows.Storage.Search.C
FolderInformation 的方法/属性与 StorageFolder 的几乎相同。 我不明白为什么 WinRT api 也提供了 FolderInformation 和 StorageFol
我尝试从网络位置读取文件。但我不断收到 UnAuthorizedAccessException。 我通过 StorageFolder.GetFolderFromPathAsync 选择 Storage
我的 Win RT 应用程序在 Windows 8 beta 上与 VS2012RC 一起使用,现在在 Visual Studio 和 Windows 8 pro 的最终版本中出现了问题,即在 OnS
我知道我可以使用 Win32 API 来访问我自己的本地数据文件夹中的文件(例如,参见 this answered question),但我需要访问我的应用程序之外的文件(例如,来自图片库)和我正在尝
在 WP8.1 上有没有办法知道 StorageFolder-obj 属于 SD 还是 Phone?谢谢你。 最佳答案 例如,您可以通过检查 Path 来做到这一点StorageFolder(或 St
我是一名优秀的程序员,十分优秀!