Operation not allowed on IsolStorageFileStream. An error occurred while moving a file from a shared file to a destination. His job
Add Namespaces
using BackgroundProcess.Resources; using Microsoft.Phone.BackgroundTransfer; using System.IO.IsolatedStorage;
Create one target directory in isolated storage
BackgroundTransferRequest transfer; using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication()) { if (isoStore.GetDirectoryNames("DestinationFolder").Length == 0) isoStore.CreateDirectory("DestinationFolder"); storage.MoveFile("/shared/transfers/xyzFileName.mp3", "DestinationFolder"); }
or use
isoStore.MoveFile(transfer.DownloadLocation.OriginalString, "DestinationFolder");
Instead of adding the file name to the destination, add the folder name.
You can play media using the following code
try { string isoFileName = "DestinationFolder//xyzFileName.mp3"; StorageFile file = null; try { file = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appdata:///local/" + isoFileName)); } catch (Exception ex) { } if (file != null) await Windows.System.Launcher.LaunchFileAsync(file); } catch (Exception ex) { }
Pooja rahangdale
source share