Back to TILs

onedrive

Date: 2023-02-23Last modified: 2023-03-07

Table of contents

Introduction

Get the drive_id

$ onedrive --get-O365-drive-id MYSHARENAME
Using dry-run database copy for OneDrive API query
Configuring Global Azure AD Endpoints
Initializing the Synchronization Engine ...
Office 365 Library Name Query: MYSHARENAME
-----------------------------------------------
Site Name:    MYSHARENAME
Library Name: name_of_library_01
drive_id:     b!RiaLHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxHk1H
Library URL:  https://yourcompany.sharepoint.com/sites/MYSHARENAME/name_of_library_01

Configure

# single quoto to prevet expansion of character !
$ DRIVE_ID='b!RiaLHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxHk1H'
$ NAME=My_Library_Name
$ CONF_DIR=~/.config/SharePoint_$NAME
$ DATA_DIR=/data/SharePoint_$NAME
$ mkdir -pv "$CONF_DIR"
$ mkdir -pv "$DATA_DIR"
$ wget https://raw.githubusercontent.com/abraunegg/onedrive/master/config \
  -O "$CONF_DIR/config"

Customize the default configuration file

$ sed -i "s|.*sync_dir = .*|sync_dir = \"$DATA_DIR\"|" "$CONF_DIR/config"
$ sed -i "s|.*drive_id = .*|drive_id = \"$DRIVE_ID\"|" "$CONF_DIR/config"

Validate the configuration file

onedrive --confdir="$CONF_DIR" --display-config

Sincronize

onedrive --confdir="$CONF_DIR" --synchronize --verbose

List

onedrive --list-shared-folders

References