How can I import a file into my Windows Phone 8.1RT App?

Hi All,
I'm running into a bit of an issue associating my app with a custom file type.  Users create a file using my app and upload it to their OneDrive for sharing.  So I then want to give the users the ability to download the file from a share link and
have that file open automatically in my app.  I've got the appropriate declarations set and file type associations, but I'm getting a file access exception when I try to open the file.  Whats the best way to import a file into my app?  Here's
the code I've got so far:
protected override async void OnFileActivated(FileActivatedEventArgs args)
var path = args.Files[0].Path;
var name = args.Files[0].Name;
StorageFile newFile = await StorageFile.GetFileFromPathAsync(path);
await newFile.CopyAsync(ApplicationData.Current.LocalFolder, name.Substring(0, name.Length - 4));
The path comes back as
C:\Data\Users\DefApps\APPDATA\Local\Packages\microsoft.microsoftskydrive_8weke\LocalState\OpenWithTempFolder\e68c261-db3b-472d-a8b7-93427450\File Name.extension
and the exception is
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
Clearly I'm trying to access the file in an inappropriate way, so what's the best way to get the file into my app's local storage?

You have the StorageFile in arg.Files[0] already. Just use that rather than getting its path and then trying to create a new StorageFile from it.
var path = args.Files[0].Path; // <= Path is unnecessary and unhelpful
var name = args.Files[0].Name;
await args.Files[0].CopyAsync(ApplicationData.Current.LocalFolder, name.Substring(0, name.Length - 4));
See my blog entry Skip the path: stick to the StorageFile for more details.

Similar Messages

  • I shot video on a Panasonic P2 and I'm trying to import the MXF files to Final Cut Pro but when I try to import, the only thing that imports is a blurry image of each clip. There's no audio and no video...how can I import MXF files into Final Cut Pro?

    I shot video on a Panasonic P2 and I'm trying to import the MXF files to Final Cut Pro but when I try to import, the only thing that imports is a blurry image of each clip. There's no audio and no video...how can I import MXF files into Final Cut Pro?

    at the end, you say "import preferences", which program are you describing?
    So im safer using footage that is remotely being pulled from iphoto...
    vs
    using footage that is imported into FCP from imovie?
    Is there anything i can do in fcp to make this footage more reliable or safer or more stable as i pull remotely from iphoto?
    All the footage, and all the libraries to all programs, or on a new pegasus 12tb raid 5 setup fyi.

  • How can I import vob files into imovie 09?

    how can I import vob files into imovie 09? i have some home movies on dvd that i want to edit.

    You might want to look at this one too.  Very easy to use and it doesn't require the Apple MPEG-2 playback component.
    http://www.dvdxdv.com/NewFolderLookSite/Products/DVDxDV.overview.htm

  • How can i import mpeg files into iMovie?

    how can i import mpeg files into iMovie?

    Where are your MPEG stored?
    I have hundreds of old MPEGs stored in my nexternal drive, but unfortunatly i was not able import them into iMovie. I did the following trick: I created a new set of a folder and subfolder and called it "Virtual_CAM/DCIM" and saved it on my desktop. Then went to Disk Utilities>File Menue>New>Disk Image from Folder. Then selected the folder on my desktop and clicked enter. I moved the .dmg file to my external (or just keep it on your desktop). I clicked on the .dmg file. It shoud be visible on the Finder. Open your Imovie and import as you do from your camera.

  • How can I import .mts files into Final Cut Studio from my Sony High Def Camcorder

    How can I import .mts files from my Sony High Def camcorder into Final Cut Studio?

    Also see: https://discussions.apple.com/community/professional_applications/search.jspa?pe opleEnabled=true&userID=&containerType=&container=&spotlight=true&q=.mts

  • How can I import .mov file into dvd studio pro?

    Hi,
    I have a .mov file and want to but a dvd with menu and chapters. But when I try to import the .mov file into dvd studio pro it says Incompatible format. How can I import my .mov file in to dvd studio pro?

    Two ways…
    Transcode into a codec like Pro Res, import into DVDSP and let it do the encoding.
    Or better yet:
    Import into Compressor, choose a DVD preset and let Compressor encode. It will make two files, separate video and audio files. Import those into DVDSP.
    Good luck.
    Russ

  • IPhoto:  How can I import pdf files into iPhoto?

    It seemed to work before but I can no longer import pdf files into iPhoto.  What heppened and how can fix it?  Many thanks in advance ... Abe

    Have you tried opening the PDF in Preview and printing using the PDF option selecting save PDF to iPhoto?
    LN

  • How can I import eex files into Applications EUL from the unix command line

    How can I import *.eex and *.dis files into an Applications EUL from the unix command line?
    Thanks

    Hi
    The simple answer is you either have to use the client tool DIS51ADM to import files using the command line (Discoverer Admin is a windows only client tool), or the Java command line which needs a browser.
    In theory if you have a browser running on your Unix box you may be able to use the Java command line to make this work.
    Best wishes
    Michael

  • How can I import VLC files into quicktime?

    I'd like to be able to import some files into Quicktime from VLC. Thanks. David

    MPEG Streamclip and the MPEG-2 Playback Component should work to demultiplex and convert VOB files. The Help menu in MPEG Streamclip should have complete instructions. You could also look into DVDxDV or Cinematize.

  • How can I import svg files into photoshop?

    I am trying to import some svg files into photoshop shapes, how is that done?

    Although you CAN open SVG into Illustrator, save it as PSD or Illustrator, I think Photoshop should directly support opening SVG files in the same way it does PDF. You set the pixel size you want and then rasterize it.

  • How can I import .wma files into iTunes???

    I have a GPX MP3 player and most of my files are .wma format. When I tried to import or open these files in iTunes, nothing happened. I'm wondering how I can import the .wma files or convert them so I can listen/import them into my library. Thanks.

    You can do it on iTunes Windows or get a converter such as EasyWMA - www.easywma.com.
    MJ

  • How can i import .pmd files into Indesign CC, which where created with pagemaker?

    Hello!
    i have a problem with a new Installation of indesign cc... i can*t import old .pmd Pagemaker files into it!!
    it was possible with Indesign cs6, but apparently no longer..!?
    ..is there an extension or anything else i could use?
    thanks in advance for any Tip,       
    sincerely Sanitest

    ..well, the fact that i can install an older Version of id is an releave...!but! the fact that i cannot open .pmd file in id cc is .. in my humble opinion
    a bad sign of things to come.. i mean sooner or later adobe will completely cancel the ability to download/use id cs6 ... and then what?... buy an old version of pagemaker
    or id 1..cs6?
    if anyone close to adobe has anything substantially to say.. please go ahead..!
    best regards Sanitest

  • How can I import .avi file into iTunes?

    I have a bunch of videos, that I can not live with out. They are al in .AVI form. How can I get these into iTunes for watching? Do I need to use Quicktime Pro?

    You use MPEG Streamclip to convert them to MPEG-4 and import those. This may require Perian or not be possible.
    (61270)

  • How can I import RW2 files into Lightroom 4?Also why can`t I see jpgs related to the same RW2 files?

    I tried ti import my RW2 camera (Lumix) raw files into Lightroom 4.4 and simply couldn`t do it. Also I had jpgs in the same folder and Lightroom didn`t bring them in at all.
    What can I do? Is there any ways or settings? Does Lightroom 5 see RW2?
    Thanks

    What Jim said.
    Either:
    Upgrade to Lightroom 5 then open the RW2 files in LR5, or
    Download the free Adobe DNG converter, convert all RW2 files to DNGs then edit the DNGs in Lightroom 4
    http://www.adobe.com/products/photoshop/extend.displayTab2.html

  • How can I import .pst files into ES2?

    I downloaded a set of patches for ES2 and only see the option to "load" them for a single use.  How do I import them so I can pull them up through the interface menu?  They are in .PST file format.
    I tried searching and the file structure didn't match how Mavericks does it with Logic Pro X.

    You might want to look at this one too.  Very easy to use and it doesn't require the Apple MPEG-2 playback component.
    http://www.dvdxdv.com/NewFolderLookSite/Products/DVDxDV.overview.htm

Maybe you are looking for

  • Os x 10.8.3 server netinstall and netrestore step by step

    hi all, i am looking for step by step instruction to configure netinstall and netrestore with automator setting and configuration.  server is 10.8.3.  any help would be great. 

  • Replacement of SAP XML Toolkit by JDK 5

    Hi, we have a lot of XSLT mappings with Java-Enhancement in our PI 7.1 system. So we are using SAP XML Toolkit at the moment. In the future release SAP doesn't want to support SAP XML Toolkit anymore. So does anybody know what we have to do for using

  • SOAP Sender Adapter Not working

    We have the following Synchronous sceanrio: Third Party System <> PI <> SAP ECC The interface works well in our DEV and PreProd environments but has stopped working in our QA environment. The SOAP Sender Adapter is giving me the following error: fail

  • PARKED INVOICE ISSUE

    Good morning SAP Gurus, I have an issue with parked invoices. I am not able to display in my  work-flow the parking reason of some parked invoices. How can I display it? Is there a way to display them? Thank you, Kind regards Elena

  • Security issue with content areas

    Hi Everyone, I was wondering if anyone else has experienced this. If you have, is there a work around? It seems like some of content area security is cached in the database. This is what happened in my two test cases. Test case 1: - First I created s