Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# login and upload to OneDrive without user interaction

I'm currently working on a Windows service that will check and update Excel files and upload them to selected cloud storage - SharePoint or OneDrive. The whole process should be fully automatic and without any user interaction - all required information (username, password etc.) are part of the config file.

All is going well except the OneDrive part. I'm unable to find a fully automatic solution to login and upload to this cloud storage. I know about Microsoft Live SDK, but 'its support for non-WinPhone and -WinStore apps is reduced and also, to my knowledge, it always requires user to enter username, password (webbrowser component).

The second option is SkyDriveClientAPI (link here), but this API doesn't work anymore (as mentioned in Issues).

Is there way to use Live SDK without user interaction or do you have any other suggestions for a different way?

like image 915
TheUlderico Avatar asked Jul 17 '14 19:07

TheUlderico


People also ask

What C is used for?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...

What is the full name of C?

In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.

What is C in C language?

What is C? C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old. C is strongly associated with UNIX, as it was developed to write the UNIX operating system.

Is C language easy?

C is a general-purpose language that most programmers learn before moving on to more complex languages. From Unix and Windows to Tic Tac Toe and Photoshop, several of the most commonly used applications today have been built on C. It is easy to learn because: A simple syntax with only 32 keywords.


1 Answers

This is partly achievable

As mentioned in the other answers, one drive requires user authentication , and this makes fully automatic solution impossible.

However an almost automatic solution is possible, meaning an app can be created that will require a single one time login (on first activation) and a following the login, an authorization by the user for the running app, from that point the app will be able to work automatically ( uploading, downloading, folder creation, direct link to uploaded files, etc....), this will continue working, even if application is shutdown, and machine is restarted.

the only way to disengage the application from the one drive connection is to sign out the app (can be achieved automatically).

This can achieved by using the LIVE sdk (desktop) and following the single sign-on guidelines, you will most likely need access to the following scopes:

  • wl.basic
  • wl.signin
  • wl.skydrive_update
  • wl.offline_access

check one drive dev center:

  • window desktop apps
  • Single sign-on for apps and websites

In order to achieve this behavior i suggest following the next steps:

  • Download the live desktop source code
  • Explore the ApiExplorer sample (Live SDK Desktop Code + ApiExplorer code sample) - this will show you how to login, logout ,download, and upload content.

After using the example to build a basic demo App:

  • enhance your App to use single sign-on capabilities,
  • enhance your App to refresh its authentication token (so session wont time out, etc)
like image 101
Curious Guy Avatar answered Sep 21 '22 14:09

Curious Guy