WLive 4.0.0.4

dotnet add package WLive --version 4.0.0.4
NuGet\Install-Package WLive -Version 4.0.0.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WLive" Version="4.0.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WLive --version 4.0.0.4
#r "nuget: WLive, 4.0.0.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install WLive as a Cake Addin
#addin nuget:?package=WLive&version=4.0.0.4

// Install WLive as a Cake Tool
#tool nuget:?package=WLive&version=4.0.0.4

Some example how to work with this framework is described on this site: http://wlivefw.codeplex.com/

Project has been on codeplex and I move it to GitHub now.

How to connect to Windows Live

There is class Connection for connection to Windows Live. You need client_id and client_secrect which you will get when you will register your application in MS site. There are static properties:

Connection.client_id = client_id; Connection.client_secret = client_secret; Connection.redirect_uri = redirect_uri; // I set this to "https://login.live.com/oauth20_desktop.srf"; Connection.connection = new Connection(); //created object connection Connection.Expired += Connection_Expired; //set this for information when access token expired

There is Connection.code property. How to give code for login is describe on this page: https://msdn.microsoft.com/en-us/library/hh826543.aspx?f=255&MSPPError=-2147217396

If you have refresh token, you can set property Connection.connection.refresh_token. If this property is set it has higher priority than code property.

If you have set this properties you can call Connection.Login(); method. This metod will login into Windows Live.

There is method which refer to Connection.Expired event. When access token expires event is fired and you can login again to renew acces token.

private void Connection_Expired(object sender, EventArgs e) { Connection.Login(); }

Now you are login in. How to upload file into Onedrive

There is class File in WLiveObjects namespace. This class has static method Create(T fileobj, Stream file, OverWriteOption owoption, RequestProgressHandler handler). T is File object to give name and description file is Stream to file which you want to upload owoption is OverWriteOption which sais if you want to create new file when it exists on Onedrive, or you want to overwrite it or nothing handler is delegate for feedback method

RequestProgressHandler handler = new RequestProgressHandler(); handler.ProgressChange += UploadProgress;

Create(file, fs, option, handler);

It will be better encapsulated in try catch block. There could be exception type of BITSException. This type of exception has method Continue. It is very easy to continue in upload when connection was broken by this method. Calling is simple:

((BITSException)exception).Continue((BITSException)exception); //exception object is parameter of method.

It could be very simple in code:

File fresult=null; try { fresult = File.Create(file, fs, option, handler); } catch(BITSException e) { BITSException bex = e; do { bool error = false; try { bex.Continue(bex); } catch(BITSException b) { bex = b; bex.Continue(bex); error = true; } }while(error); fresult = (File)bex.Result; }

There is method which refer to delegate in handler. When there is change in upload progress upload mechanism will call this method by handler.ProgressChange(int bytes transfered, double percent)

void UploadProgress(int bytes, double proc) { Console.WriteLine(“{0};{1}”proc, bytes); }

Product Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.0.0.4 1,168 10/1/2017

This release (4.0.0.4) is stable and can be used to work with Windows Live. Functions of framework are focused to working with Onedrive (other objects are implemented so but there may not be some functions) but source codes are avalaible and this framework can be applied to other objects of Windows Live.