Skip to content

Code used to manage syncing a Windows 10 folder with oneDrive without adding the account to the oneDrive app.

License

Notifications You must be signed in to change notification settings

rdewald/onedrivemyway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oneDrive MyWay

This repository is code I used to manage syncing a Windows 10 folder with a personal oneDrive account without adding the account to the Windows 10 native oneDrive app.

This is useful when using a computer restricted according to Windows security policies to disable adding personal oneDrive accounts to the native Windows 10 synchronization application (a common configuration for work computers).

Take note that the aforementioned business Windows security policy must authorize the underlying Microsoft Graph API to get this to work at all, but it is common to find these libraries authorized (for other reasons), even in highly secure business environments. Fortunately, some key Azure features rely on this this API also.

In brief, one generates an authentication token for the personal oneDrive account and declares it during an R session using .Renviron (see Renviron_example.txt). Once the session closes, the token is no longer available. Be advised that this method depends upon node.js (linked below) and the Microsoft Office 365 Command-Line Interface being installed on the workstation in use.

What to expect

When you run the get_personal_onedrive() function the first time, it will either call httpuv (if you're using RStudio Workbench, for example) or give you a URL to target for authentication to your personal Google account using system web browser.

  • That is, if httpuv is not present (or you're doing this over a CLI) it will drop to the "device code" method (one can also pre-select this method with with get_onedrive_personal(auth_type= "device_code")). You will find a string to enter into any web browser authorized on the personal oneDrive account.

When the authorization with the personal Microsoft account is successful, your CLI key will be printed to your R console. This is what goes in the .Renviron configuration.

rdewald.R

My workflow

  • copy upload target files to child folder declared in .Renviron.
  • source(rdewald.R)
  • delete upload target files (this is a one-way sync)

Good luck!

.Renviron_example.txt

Paste in your CLI key and save this as .Renviron to do this like I do.

Helpful Linkage

About Microsoft365R

Install CLI guide

Install node.js

Quick start guide

About

Code used to manage syncing a Windows 10 folder with oneDrive without adding the account to the oneDrive app.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages