I have place a xml file online on OneDrive and shared whit everyone that use my program. Now I want to read this into my C# application. I have try a lot of code. A list below:
I have try whit a HttpClient
and a HttpResponseMessage
. But it give me the html code from the webpage of OneDrive. I understand why if you look to the page.
I have also looking for to use LiveSDK in my application whit the following code:
try
{
LiveConnectClient liveClient = new LiveConnectClient(this.session);
LiveOperationResult operationResult = await liveClient.GetAsync(@"https://onedrive.live.com/?****");
dynamic result = operationResult.Result;
}
catch (LiveConnectException ex)
{
Debug.WriteLine("LiveConnectException catched => " + ex.Message);
}
But I can't create an instance of LiveConnectClient
because you need to log in and I don't want that. Found on this links: "Working with Microsoft OneDrive folders and files" on MSDN and "Store LiveConnectSession in WP7" on Stackoverflow.
Can anyone help me or explain it? I need only the xml code (not the html code) and will make a graph of the data. I use the language C# for load the file. Sorry for my bad english or some mistakes, I'm new with Microsoft Live accounts and access in into an application.
Thanks
If you have a single file that you'd just like your clients to be able to download, you'll just want to assemble a variant on the sharing link that you received from the share UI, which should look like this:
https://onedrive.live.com/redir
?resid=8bf6ae9dbc6caa4c!116505
&authkey=!AD0q0bcg_i3dmvg
&ithint=file%2ctxt
You will want to modify the path from redir into download, and you can removed the ithint parameter so the request looks like the following:
https://onedrive.live.com/download.aspx
?resid=8bf6ae9dbc6caa4c%216505
&authkey=%21AD0q0bcg_i3dmvg
This url should allow you to make an anonymous request and download that shared file for your applications usage.
For more robust sharing scenarios, I'd recommend looking at https://dev.onedrive.com for a list of all supported scenarios with examples on how to use them