Windows 8 StorageFile.GetFileFromPathAsync Using UNC Path

一笑奈何 提交于 2019-12-02 09:53:35

I have sorted this out and the way I found best to do it was to create a folder object enumnerate over the files in the folder object copy the files one at a time to the local folder then access them

It seems that you can't open the files, but you can copy them. ( which was what I was trying to achieve in the first place )

Hope this helps

private async void Initialize()
    {
        try
        {

            var myfldr = await Windows.Storage.StorageFolder.GetFolderFromPathAsync(@"\\ALL387\Temp");
            var myfiles = await myfldr.GetFilesAsync();

            foreach (StorageFile myfile in myfiles)
            {
                StorageFile fileCopy = await myfile.CopyAsync(KnownFolders.DocumentsLibrary, myfile.Name, NameCollisionOption.ReplaceExisting);
            }

            var dsd = await Windows.Storage.KnownFolders.PicturesLibrary.GetFilesAsync();

            foreach (var file in dsd)
            {
              StorageFile  sampleFile = await Windows.Storage.StorageFile.GetFileFromPathAsync(file.Path);
            }


        }
        catch (FileNotFoundException)
        {
            // sample file doesn't exist so scenario one must be run
        }

        catch (Exception e)
        {
            var fred = e.Message;

        }
    }

Just Go into AppXManifest and set capabilities

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