文档文件夹中的访问被拒绝 [英] Access Denied in Document Folders
问题描述
我试图通过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
这篇关于文档文件夹中的访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!