One note .one file does not open on windows phone 8.1 C #

1

I have a Windows Phone 8.1 app that accesses OneDrive after authentication, I have access to all files / folders and subfolders of the logged in account. I am having an error while trying to open the native one note app after calling my Task OpenFile .

Following error:

  

Can not open file There is a problem with this file and OneNote can not   open it

All files of type: .docx/ .xlsx/ .pptx are opening native apps as expected.

Has anyone ever had this same problem?

public async Task OpenFile (IItem fileItem)
    {
        StorageFolder localFolder = ApplicationData.Current.LocalFolder;

        StorageFile storageFile = await localFolder.CreateFileAsync(fileItem.Name, CreationCollisionOption.ReplaceExisting);
        IRandomAccessStream writeStream = await storageFile.OpenAsync(FileAccessMode.ReadWrite);

        using (Stream outputStream = Task.Run(() => writeStream.AsStreamForWrite()).Result)
        {                
            Stream downloadStream = await DownloadFileAsync(fileItem);

            await downloadStream.CopyToAsync(outputStream);
        }

        var filerun = await ApplicationData.Current.LocalFolder.GetFileAsync(fileItem.Name);

        var options = new LauncherOptions() { DisplayApplicationPicker = true };
        await Launcher.LaunchFileAsync(filerun, options);
    }

    public async Task<Stream> DownloadFileAsync(IItem file)
    {
        Stream stream = null;
        File fileDownload;

        fileDownload = file as File;

        stream = await fileDownload.DownloadAsync();

        return stream;
    }
    
asked by anonymous 30.06.2016 / 15:41

0 answers