Windows 8 StorageFile.GetFileFromPathAsync Using UNC Path

前端 未结 2 470
小鲜肉
小鲜肉 2021-01-28 17:46

Has anyone EVER managed to use a windows 8 app to copy files from a unc dir to a local dir ?

According to the official documentation here

It is possible to conne

相关标签:
2条回答
  • 2021-01-28 18:16

    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;
    
            }
        }
    
    0 讨论(0)
  • 2021-01-28 18:19

    Just Go into AppXManifest and set capabilities

    0 讨论(0)
提交回复
热议问题