• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

文档文件夹的访问被拒绝

用户头像
it1352
帮助1

问题说明





我试图通过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

正确答案

#1

除了其他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
系列文章
更多 icon
同类精品
更多 icon
继续加载