locked
Metro App : How to move file from MyDocuments to app local folder (Application instalation folder) RRS feed

  • Question

  • Hi all,

    I wanted to move file created in My Document folder to , App local storage without using file picker. Where file in MyDocument is created by WCF service.

    Thanks in Advance

    Regard's

    Gopalakrishna M

    Monday, August 19, 2013 12:26 PM

Answers

  • It seems location you're trying to access doesn't have files with the name that you specified. I guess the exception might be thrown when you tried to access the library, not on CopyAsync. BTW, Can you see your PDF file in the Picture Library ?

    - Ram
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    • Marked as answer by Gopikris Tuesday, August 20, 2013 11:32 AM
    Tuesday, August 20, 2013 6:42 AM

All replies

  • Which part of this is giving you trouble?

    In almost all cases you will need to use the file or folder picker to get access to the documents folder.

    Once you have the StorageFile for the file you want you can copy it with StorageFile.CopyAsync .

    --Rob

    Monday, August 19, 2013 3:20 PM
    Moderator
  • I want to create PDF report in my application.

    Since there is no api from the from Microsoft. Iam using PDF sharp to create by placing the wcf call. I want to move this PDF file to my app local folder.

    I am using this two statement in my app please help me to resolve

    StorageFile databaseFile = await Windows.Storage.KnownFolders.PicturesLibrary.GetFileAsync("Hello.PDF");

                await databaseFile.CopyAsync(ApplicationData.Current.LocalFolder);

    where copyasync is throwing following exception

    The system cannot find the file specified. (Exception from HRESULT: 0x80070002)

    Tuesday, August 20, 2013 6:12 AM
  • It seems location you're trying to access doesn't have files with the name that you specified. I guess the exception might be thrown when you tried to access the library, not on CopyAsync. BTW, Can you see your PDF file in the Picture Library ?

    - Ram
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    • Marked as answer by Gopikris Tuesday, August 20, 2013 11:32 AM
    Tuesday, August 20, 2013 6:42 AM
  • It has a file,  the execution of statement StorageFile databaseFile =await Windows.Storage.KnownFolders.PicturesLibrary.GetFileAsync("Hello.PDF"); is successful.After the execution i checked the object , it has every information.

    But the statement

    await databaseFile.CopyAsync(ApplicationData.Current.LocalFolder);

    throwing an exception.

    Tuesday, August 20, 2013 8:29 AM
  • the parameter passed for the CopyAsync(ApplicationData.Current.LocalFolder); is incorrect , we changed to CopyAsync(ApplicationData.Current.LocalFolder,"Hello.PDF"); is is working, thanks for your help 

    Tuesday, August 20, 2013 11:48 AM