0

I have developed a Metro app. I have a page that saves the user's selected image. When I choose the image in the pictures folder, an error will occur:

Error HRESULT E_FAIL has been returned from a call to a COM component

But if I choose from another folder, everything will proceed smoothly and save the image name into the database.

Here is the snippet:

if (file != null)
{
    StorageFolder documentsFolder = KnownFolders.PicturesLibrary;
    output = await file.CopyAsync(documentsFolder, 
                                  file.Name.ToString(), 
                                  NameCollisionOption.ReplaceExisting);
}
Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
Tom
  • 1
  • I dont think your title reflects your actual question very well. It seems like your title should be something like `Error occurs when opening image from pictures folder` – crthompson Sep 19 '13 at 04:39
  • 1
    What do you mean by _another folder_? Have you added capability to access pictures library in manifest? – Farhan Ghumra Sep 19 '13 at 05:11
  • did you try to selecting 'No Authentication Required' from 'Network DTC Access'...?? – Aurangzeb Halepoto Sep 19 '13 at 05:29
  • @Xyroid I have added the capability. Another means example I picked a image and the path is "Libraries\Pictures\Examples\example.png" than if won't have any error. If I chose the image from "Libraries\Pictures\example.png" than it will have error. My purpose is to let user pick the image than it store the image name into the database than CopyAsync the image chosen to the Pictures Folder. Thanks. – Tom Sep 19 '13 at 14:13
  • @AurangzebHalepoto Sorry what you mean by that ? Thanks. – Tom Sep 19 '13 at 14:14
  • check out this link [filesavepicker](http://stackoverflow.com/questions/17571152/how-to-save-existing-storagefile-using-filesavepicker) – Aurangzeb Halepoto Sep 20 '13 at 04:26

0 Answers0