How to check whether the file exists? RRS feed

  • Question

  • i want to open a file,in my Metro app, in documents library if it exists or copy it from other path if not,what can i do?

    Monday, April 9, 2012 3:59 AM


  • You can call StorageFile.CopyAsync(IStorageFolder, String, NameCollisionOption) with FailIfExists option to copy the file from other path. if it fails, you can open the file by calling StorageFolder.CreateFileAsync(String, CreationCollisionOption) with OpenIfExists option.

    Best Regards,

    Han Xia

    Monday, April 9, 2012 6:30 AM