文档文件夹的访问被拒绝
问题说明
我试图通过WP8.1手机应用程序将文件从Picture Library文件夹复制到Document文件夹但是我得到了拒绝访问权限。
当我尝试将文件从图片库复制到相机胶卷文件夹时n文件被复制而没有任何错误/异常。
下面是在处理Document文件夹时给出异常的代码:
StorageFolder ^ picturesFolder = KnownFolders :: DocumentsLibrary;
create_task(file-> CopyAsync(picturesFolder," sample - Copy.dat",NameCollisionOption :: ReplaceExisting))。then([this,file](task< StorageFile ^>
任务)
{ < br style ="color:#333333; font-family:'Helvetica Neue',Arial,Helvetica,sans-serif; font-size:15px; line-height:22.5px">
try
{
StorageFile ^ sampleFileCopy = task.get();
rootPage-> NotifyUser("'file'" file-> Name "'被复制,新文件被命名为'" sampleFileCopy-> Name
"'。",NotifyType :: StatusMessage);
}
catch(COMException ^ ex)
{
rootPage-> HandleFileNotFoundException(ex);
}
});
}
实际上我需要将图片库中的文件夹复制到文件夹中。请帮助。
谢谢,
Deepak
Hi,
I am trying to copy file from Picture Library folder to Document folder via WP8.1 phone app, however I am getting the Access Denied Exception.
When I tried to copy the file from Picture Library to Camera Roll folder than the file gets copied without any Error/Exception.
Below is the code that is giving exception while coping to Document folder:
StorageFolder^ picturesFolder = KnownFolders::DocumentsLibrary;
create_task(file->CopyAsync(picturesFolder, "sample - Copy.dat", NameCollisionOption::ReplaceExisting)).then([this, file](task<StorageFile^> task)
{
try
{
StorageFile^ sampleFileCopy = task.get();
rootPage->NotifyUser("The file '" file->Name "' was copied and the new file was named '" sampleFileCopy->Name "'.", NotifyType::StatusMessage);
}
catch (COMException^ ex)
{
rootPage->HandleFileNotFoundException(ex);
}
});
}
Actually I need to copy the folder present in Picture Library to the Document Folder. Kindly assist.
Thanks,
Deepak
正确答案
除了其他KnownFolders之外,Windows Phone上的应用程序无法自由访问文档库。有关详细信息,请查看此处的说明:
http://msdn.microsoft.com/en-us/library/windows.storage.knownfolders.documentslibrary.aspx
如果你确实需要在那里创建文件也许能够使用FileSavePicker,如下所述:
http://msdn.microsoft.com/library/windows/apps/windows.storage.pickers.filesavepicker.aspx
If you do need to create files there you might be able to use the FileSavePicker as described here: http://msdn.microsoft.com/library/windows/apps/windows.storage.pickers.filesavepicker.aspx
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcfgabc
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20