C# UWP LiveSKD and OneDrive access using FileOpenPicker - c#

I'm developing a Universal Windows Platform app that allows a user to open and edit files using the FileOpenPicker. The idea is that the user can choose any file on their computer, including files located in their OneDrive folders. On Windows 10 Desktop, this is working perfectly.
However, on a Windows Phone 10 device, the result is very different. When a user chooses a file with the picker, the file is downloaded to a local storage folder, and the user is able to edit the file. But when the file is edited, it is not synced back to OneDrive.
According to https://dev.onedrive.com/
Picker SDKs enable your app to open and save files on OneDrive with hardly any code.
And also here https://dev.onedrive.com/sdks.htm, it says
Add OneDrive to your app in minutes with a few lines of code.
Get a link from OneDrive for sharing or downloading the contents of a file.
Save a file on the user's local device to OneDrive so it's available on all your users' devices.
This is a little confusing to me. From what I understand, I should be able to open files from OneDrive using the picker, and also save them. But is seems to only be able to open the file, and when I edit it, only the local copy is modified. It's never synced back to OneDrive
Has anyone else experienced this issue? Does anyone know how to use the FileOpenPicker to open and modify a file on OneDrive, and have it synced back to OneDrive?
By the way, I have also looked at this stackoverflow question and answer, but this doesn't seem to address the same issue I am having:
How to open a file from OneDrive with FileOpenPicker?
I really appreciate any help or guidance on this. Thanks!

I'm having the same issue and it has been like this with the OneDrive app since the API's were introduced with WP 8.1. The API's work fine because the Dropbox app supports them and it works as expected. You can do testing with that and hopefully Microsoft will get their act together.
There's a post on the msdn forums back in July of 2014 about it and other issues with no answers.

Related

Windows Forms, Microsoft OneDrive and Settings.Settings class

I have a Windows forms application that uses Application settings using the .NET settings class.
Typically I have a setting such as WindowXSize which is loaded when the program starts, and saved when it ends as follows:
Properties.Settings.Default.WindowXSize = 400;
Properties.Settings.Default.Save;
On load it is just the reverse.
Now this works fine and I have thousands of users with no issues. However, if someone has configured MicroSoft OneDrive to replicate their documents folder, the values never change even if the window is resized.
Not only that, the software can also allow users to save various files in a folder of their choice. Most of the time this is in the documents folder (or subfolder of it). To make sure I get the correct location of the Documents folder I have the following:
path = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
This always returns the typical c:\users\userid\documents folder even if OneDrive is syncing the documents folder. The user can then save the file and there are no errors. However, if the user then tries to load it, the file is not found. So it would seem that OneDrive is completely ignoring the .NET mechanisms for Application settings and file IO.
Is there any work around for this? Or am I doing something wrong?
Note that I refuse to load up OneDrive for my documents on my development machine so as to avoid all these issues as well as many others that exist.
Thanks, Tom
Did you change the directory, where your application stores the user settings?
Default is:
"User settings are saved in a file within a subfolder of the user’s local hidden application data folder." 1
Normally OneDrive does not synchronize this hidden AppData folder. Therefore your question makes little sense. Please add more information.

How to add photo to iPhone from desktop?

Recently, i want to create an application to sync photos between iphone and desktop by using C# language. I use Manzana library to copy image from PC to iphone.
As my understanding, the image file should be put under to /private/var/mobile/Media/PhotoData/Sync folder. But this does not work, i cannot see imported file when browse iphone photos although the file is copy to the location correctly.
Then i try to update the database file /private/var/mobile/Media/PhotoData/Photos.sqlite. To add a new entry to represent the imported photo file. Then i can see photo in iphone, but without thumbnails. And i have to restart the album application (close the application and start it again) so that to see the new imported photo.
But i found other tools can sync photo to iphone and can see the change immediately without restart the album application.
I want to know how this function is implemented?
Manzana is a C# wrapper of iTunesMobileDevice.dll. the main functionality is deal with iphone file system. and this is quite a old library which is not updated for a long time. I am not sure if there are any APIs to allow user to select an folder or photo file and sync it to iphone just like we do it in itunes, so that we don't need to process the db and thumbnails.
Does anyone have such experience before?
Im using desktop Dropbox as a buffer between mobile app and desktop.
Before this, you need a DropBox registered account and install the application.
After that, simple create a new folder from desktop Dropbox, drag-and-drop all
your photos into the new folder
Then, return to your iphone and retrieve them from DropBox mobile app.

locations to save files which can be accessed on app

I want to supply a bunch of files with my Windows Phone 8.1 app which are necessary for running the application. I searched on the net and found that this page. But I don't know which place in particular is the ApplicationData.Current folder. What I want is the following:-
Can I create a folder called Resources or use the existing Assets folder in my Project tree and save the files in there.
If yes, then how can I access that folder from within my App i.e. how can I open and close files in that Directory(relative or absolute addressing format to be used)? If you can provide a one or two line code for this, it would be great.
Do I have to use the ReadTextAsync method to read the entire text of the file into a string or are there any other methods.(The System.IO.File.ReadAllText() method is not accessible when creating Windows 8.1 Phone app).
Thanks in advance.
Your App is installed on SD or Phone, depending on user Settings on the Phone. You can't normally access those files eg. by browsing files while Phone is connected to computer - the apps are Isolated.
Depending on your App:
if it's 8.1 Silverlight then you will find all the information here at MSDN.
if it's 8.1 RunTime then take a look here.
Although you can't access files inside your App from outside the App, from WP8.1 you have access (read/write) to SD Card and other KnownFolders.
EDIT - you can also access your files by using Uri schemes.

Fileupload into WP7 application

I just have a "short" Question. I did a lot of research the last few hours and found out, that a Wp7 application has access to his own directory and the IsolatedStorage. So if I want to work with a file in my application I either have to load it into the project using the Solutionexplorer in VS, or create a file manually by code, load it into the Isolated Storage and then read out of it.
So i come to the result that it isnt possible to load a specific file, which is in an unknown directory or folder and has an unknown name from my mobile Phone (or WP7 emulator) into the App directly, right? Because there is no browsing feature or something like e.g. in the ASP.NET Webform,the FileUploadControl.
Is my understanding correct or do I miss something?
you cannot access anything that is on the phone (except music and photo lib etc) other than whats included with the app and its isolated storage area.
you can't browse the local device like you can on windows. however you can download files from the net.

How to Play Video File On D Drive In WinRT?

Using XAML C# in Windows "Metro" Apps how do I go about playing a certain video file. Examples:
D:\video1.wmv
\\MEDIAPC\video2.wmv
The only way I managed to get this working so far is by using FilePicker, but I don't want to use this as I already have a list of files to play.
I have tried to use GetFileFromPathAsync but I keep getting permission / access issues
await StorageFile.GetFileFromPathAsync(#"D:\video1.wmv");
Apologies if this has been answered I just couldn't find an answer that fits my problem.
If your D:\ drive is a non-network resource try adding the Removable storage application capability. This can be accomplished by double-clicking on the Package.appxmanifest and navigating to the Capabilities tab. By default your application (assuming it is a Windows Store app) only has access to local files packaged with your app or files stored in local/roaming/temp folders (usually reserved for Application state).
If your data is stored on a Network resource that requires authentication you will want to enable the Enterprise Authentication capability.
You may also want to fiddle with the Home and Work Networks for the \MEDIAPC\ files if you aren't accessing resources that require network authentication.
Further Reads:
Accessing data and files
How to load data from files
App Capabilities Overview

Categories

Resources