Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement OneDrive Business Shared Folders Support (Issue #459) #473

Merged
merged 123 commits into from
Jun 27, 2020
Merged
Show file tree
Hide file tree
Changes from 109 commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
5cc0558
Inital work on supporting OneDrive Business Shared Folders
abraunegg Apr 23, 2019
926cb3e
Update sync.d
abraunegg Apr 23, 2019
cd80654
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Apr 23, 2019
4d47b7e
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Apr 24, 2019
015e2d6
Update --single-directory handling for OneDrive Business Shared Folders
abraunegg Apr 24, 2019
67e287a
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Apr 25, 2019
3aea32f
Add readme & code cleanup
abraunegg Apr 25, 2019
a80917d
Update README.BusinessSharedFolders.md
abraunegg Apr 25, 2019
1f5de86
update business shared folder handling
abraunegg Apr 30, 2019
7e49cb7
update logic and readme
abraunegg May 2, 2019
785ad86
Update README.BusinessSharedFolders.md
abraunegg May 2, 2019
16a0865
Update sync.d
abraunegg May 3, 2019
38e9332
Update sync.d
abraunegg May 3, 2019
7cd9f5f
Update sync.d
abraunegg May 3, 2019
e058fca
Merge branch 'master' into onedrive-business-shared_folders
abraunegg May 5, 2019
4382c92
Update sync.d
abraunegg May 5, 2019
3eb9fe2
Update sync.d
abraunegg May 6, 2019
53d63b0
Merge branch 'master' into onedrive-business-shared_folders
abraunegg May 9, 2019
1b226d1
Merge branch 'master' into onedrive-business-shared_folders
abraunegg May 11, 2019
5110811
Merge branch 'master' into onedrive-business-shared_folders
abraunegg May 13, 2019
df79c7f
Update README.BusinessSharedFolders.md
abraunegg May 16, 2019
3da8e32
Update README.BusinessSharedFolders.md
abraunegg May 16, 2019
50d06d5
Merge branch 'master' into onedrive-business-shared_folders
abraunegg May 23, 2019
7398209
Merge branch 'master' into onedrive-business-shared_folders
abraunegg May 24, 2019
5ed817b
Merge branch 'master' into onedrive-business-shared_folders
abraunegg May 30, 2019
4132701
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jun 3, 2019
a045a0c
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jun 7, 2019
2f26f6f
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jun 9, 2019
998c4c2
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jun 10, 2019
ed5ab90
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jun 11, 2019
7d98b83
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jun 12, 2019
a8e2ef1
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jun 13, 2019
d290726
Update file locations to align to PR #523
abraunegg Jun 13, 2019
af733d4
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jun 14, 2019
288b78d
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jun 17, 2019
689deaf
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jun 18, 2019
f6b86a1
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jun 18, 2019
b442a0c
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jun 23, 2019
e05eeb8
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jun 27, 2019
b621113
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jun 28, 2019
ad87e12
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jun 30, 2019
2cf0fda
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jul 2, 2019
bac591a
Rebase to master
abraunegg Jul 9, 2019
a205de9
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jul 10, 2019
3dc4d91
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jul 13, 2019
b1ad198
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jul 13, 2019
c8bd2dd
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jul 16, 2019
5240bcd
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jul 24, 2019
7bc8377
fix merge conflicts
abraunegg Aug 2, 2019
7a2fda0
Update sync.d
abraunegg Aug 3, 2019
694e51e
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Aug 3, 2019
c8a5ca9
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Aug 9, 2019
6dbf5db
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Aug 22, 2019
8c9bcd7
update from master
abraunegg Aug 25, 2019
540e006
Update main.d
abraunegg Aug 25, 2019
4d72065
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Aug 31, 2019
96b841b
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Sep 6, 2019
55fb2ff
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Sep 9, 2019
60af7c0
merge changes from 'master'
abraunegg Sep 9, 2019
5db0e33
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Sep 12, 2019
0fc737d
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Sep 23, 2019
4ca170e
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Sep 23, 2019
fbb5a6c
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Sep 24, 2019
9e8b7d2
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Oct 1, 2019
efedf9f
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Oct 9, 2019
2aac493
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Oct 9, 2019
a142ecc
Update sync.d
abraunegg Oct 9, 2019
87e3bf2
update from master
abraunegg Oct 31, 2019
7d2d2b8
Fix build error
abraunegg Oct 31, 2019
7dbc589
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Nov 5, 2019
744edf0
Update sync.d
abraunegg Nov 9, 2019
e22879a
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Nov 12, 2019
41e358f
Update & resolve conflicts
abraunegg Nov 29, 2019
32ecd01
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Dec 15, 2019
ba5dc7c
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Dec 16, 2019
faee2de
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Dec 31, 2019
a4b227a
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jan 2, 2020
b660d6a
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jan 2, 2020
7f895f8
Fix conflicts when merging master
abraunegg Jan 2, 2020
5b6ed10
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jan 3, 2020
1af2e7a
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jan 29, 2020
f510566
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Feb 3, 2020
4cc1aad
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Feb 15, 2020
64e4458
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Feb 15, 2020
3641fd5
Update onedrive.d
abraunegg Feb 21, 2020
d707b04
Fix conflicts
abraunegg Mar 19, 2020
2db73b3
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Mar 20, 2020
aa9d141
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Mar 22, 2020
17f5ce9
Update from master
abraunegg Mar 23, 2020
1bdfcf7
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Mar 27, 2020
5a34ed7
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Mar 28, 2020
9a5b79a
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Mar 29, 2020
59f4797
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Mar 31, 2020
21808ab
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Apr 2, 2020
28709b5
update from 'master'
abraunegg Apr 6, 2020
baf2e60
update from master
abraunegg Apr 15, 2020
8cb7ce0
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Apr 20, 2020
c6cd139
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Apr 20, 2020
f9c3806
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Apr 22, 2020
22ca07c
Merge branch 'master' into onedrive-business-shared_folders
abraunegg May 3, 2020
083fb04
Update from 'master' and resolve conflicts
abraunegg Jun 13, 2020
a6099e2
Update main.d
abraunegg Jun 13, 2020
b49d5b4
Merge branch 'master' into onedrive-business-shared_folders
abraunegg Jun 16, 2020
cbda90d
Update from 'master' and resolve conflicts
abraunegg Jun 17, 2020
78de3c0
Update OneDrive Business Shared Folder Support
abraunegg Jun 19, 2020
f24ea77
Update README.BusinessSharedFolders.md
abraunegg Jun 19, 2020
dd169b9
Update sync.d
abraunegg Jun 19, 2020
49aa42c
Update to handle feature via config file
abraunegg Jun 19, 2020
ede53a5
Update documentation
abraunegg Jun 19, 2020
1cee4ee
Update selective.d
abraunegg Jun 19, 2020
cb98a9b
Update from 'master' and resolve conflicts
abraunegg Jun 20, 2020
e16960b
Update sync.d
abraunegg Jun 20, 2020
bbf4b2d
Update Makefile.in
abraunegg Jun 20, 2020
2304df1
Update main.d
abraunegg Jun 21, 2020
6c4d885
Update sync.d
abraunegg Jun 21, 2020
15a845c
Update sync.d
abraunegg Jun 21, 2020
718e341
Update sync.d
abraunegg Jun 22, 2020
a7288c9
Update main.d
abraunegg Jun 22, 2020
ecf4ed7
PR logging tweaks
abraunegg Jun 23, 2020
850f856
Add known issue details
abraunegg Jun 23, 2020
b0bad0a
Update BusinessSharedFolders.md
abraunegg Jun 24, 2020
c1e639c
Update sync.d
abraunegg Jun 26, 2020
bcc7068
Update BusinessSharedFolders.md
abraunegg Jun 26, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ endif
system_unit_files = contrib/systemd/onedrive@.service
user_unit_files = contrib/systemd/onedrive.service

DOCFILES = README.md config LICENSE CHANGELOG.md docs/Docker.md docs/INSTALL.md docs/Office365.md docs/USAGE.md
DOCFILES = README.md config LICENSE CHANGELOG.md docs/Docker.md docs/INSTALL.md docs/Office365.md docs/USAGE.md docs/README.BusinessSharedFolders.md

ifneq ("$(wildcard /etc/redhat-release)","")
RHEL = $(shell cat /etc/redhat-release | grep -E "(Red Hat Enterprise Linux Server|CentOS)" | wc -l)
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ This client is a 'fork' of the [skilion](https://github.com/skilion/onedrive) cl
* File upload / download validation to ensure data integrity
* Resumable uploads
* Support OneDrive for Business (part of Office 365)
* Shared folders (OneDrive Personal)
* SharePoint / Office 365 Shared Libraries
* Shared Folder support for OneDrive Personal and OneDrive Business accounts
* SharePoint / Office365 Shared Libraries
* Desktop notifications via libnotify
* Dry-run capability to test configuration changes
* Prevent major OneDrive accidental data deletion after configuration change
Expand All @@ -37,6 +37,9 @@ See [docs/USAGE.md](https://github.com/abraunegg/onedrive/blob/master/docs/USAGE
## Docker support
See [docs/Docker.md](https://github.com/abraunegg/onedrive/blob/master/docs/Docker.md)

## OneDrive Business Shared Folders
See [docs/BusinessSharedFolders.md](https://github.com/abraunegg/onedrive/blob/master/docs/docs/BusinessSharedFolders.md)

## SharePoint / Office 365 Shared Libraries (Business or Education)
See [docs/Office365.md](https://github.com/abraunegg/onedrive/blob/master/docs/Office365.md)

Expand Down
2 changes: 2 additions & 0 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@
# application_id = ""
# resync = "false"
# bypass_data_preservation = "false"
# azure_ad_endpoint = ""
# sync_business_shared_folders = "false"
121 changes: 121 additions & 0 deletions docs/BusinessSharedFolders.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# How to configure OneDrive Business Shared Folder Sync
Syncing OneDrive Business Shared Folders requires additional configuration for your 'onedrive' client:
1. List available shared folders to determine which folder you wish to sync & to validate that you have access to that folder
2. Create a new file called 'business_shared_folders' in your config directory which contains a list of the shared folders you wish to sync
3. Perform a sync

## Listing available OneDrive Business Shared Folders
List the available OneDrive Business Shared folders with the following command:
```text
onedrive --list-shared-folders
```
This will return a listing of all OneDrive Business Shared folders which have been shared with you and by whom. This is important for conflict resolution:
```text
Initializing the Synchronization Engine ...

Listing available OneDrive Business Shared Folders:
---------------------------------------
Shared Folder: SharedFolder0
Shared By: Firstname Lastname
---------------------------------------
Shared Folder: SharedFolder1
Shared By: Firstname Lastname
---------------------------------------
Shared Folder: SharedFolder2
Shared By: Firstname Lastname
---------------------------------------
Shared Folder: SharedFolder0
Shared By: Firstname Lastname (user@domain)
---------------------------------------
Shared Folder: SharedFolder1
Shared By: Firstname Lastname (user@domain)
---------------------------------------
Shared Folder: SharedFolder2
Shared By: Firstname Lastname (user@domain)
...
```

## Configuring OneDrive Business Shared Folders
1. Create a new file called 'business_shared_folders' in your config directory
2. On each new line, list the OneDrive Business Shared Folder you wish to sync
```text
[alex@centos7full onedrive]$ cat business_shared_folders
TestSharedFolder
ThisDoesNotExist
SomeRubbishFolder
AnotherSharedFolder
[alex@centos7full onedrive]$
```
3. Validate your configuration with `onedrive --display-config`:
```text
onedrive version = v2.3.3-1-gc8e47a4
Config path = /home/alex/.config/onedrive
Config file found in config path = true
Config option 'check_nosync' = false
Config option 'sync_dir' = /home/alex/OneDrive
Config option 'skip_dir' =
Config option 'skip_file' = ~*|.~*|*.tmp
Config option 'skip_dotfiles' = false
Config option 'skip_symlinks' = false
Config option 'monitor_interval' = 45
Config option 'min_notify_changes' = 5
Config option 'log_dir' = /var/log/onedrive/
Selective sync configured = false
Selective Business Shared Folders configured = true
business_shared_folders contents:
TestSharedFolder
ThisDoesNotExist
SomeRubbishFolder
```

## Performing a sync of OneDrive Business Shared Folders
Perform a sync using the following command: `onedrive --synchronize --sync-shared-folders`:
```text
onedrive --confdir '~/.config/onedrive --synchronize --verbose --sync-shared-folders
Using Config Dir: /home/alex/.config/onedrive
Initializing the OneDrive API ...
Opening the item database ...
All operations will be performed in: /home/alex/OneDrive
Initializing the Synchronization Engine ...
Account Type: business
Default Drive ID: <redacted>
Default Root ID: 01WOGXO2N6Y2GOVW7725BZO354PWSELRRZ
Remaining Free Space: 1099329560663
Fetching details for OneDrive Root
OneDrive Root exists in the database
Syncing changes from OneDrive ...
Applying changes of Path ID: 01WOGXO2N6Y2GOVW7725BZO354PWSELRRZ
Syncing OneDrive Business Shared Folder: SomeRubbishFolder
Applying changes of Path ID: 01DBFNO5QIQCS5F3EUOVAKDH7TL7ROL6BM
Syncing OneDrive Business Shared Folder: TestSharedFolder
Applying changes of Path ID: 01DBFNO5VLLTCOGVRW6ZBYFBKAXHJI5IGF
Uploading differences of /home/alex/OneDrive
Processing root
The directory has not changed
Processing Cygwin.zip
The file has not changed
Processing local_dir
The directory has not changed
Processing asdf.txt
The file has not changed
Uploading new items of /home/alex/OneDrive
Applying changes of Path ID: 01WOGXO2N6Y2GOVW7725BZO354PWSELRRZ
Syncing OneDrive Business Shared Folder: SomeRubbishFolder
Applying changes of Path ID: 01DBFNO5QIQCS5F3EUOVAKDH7TL7ROL6BM
Syncing OneDrive Business Shared Folder: TestSharedFolder
Applying changes of Path ID: 01DBFNO5VLLTCOGVRW6ZBYFBKAXHJI5IGF
```
**Note:** Whenever you modify the `business_shared_folders` file you must perform a `--resync` of your database to clean up stale entries due to changes in your configuration.

## Enable / Disable syncing of OneDrive Business Shared Folders
Performing a sync of the configured OneDrive Business Shared Folders can be enabled / disabled via adding the following to your configuration file.

### Enable syncing of OneDrive Business Shared Folders
```text
sync_business_shared_folders = "true"
```

### Disable syncing of OneDrive Business Shared Folders
```text
sync_business_shared_folders = "false"
```
22 changes: 18 additions & 4 deletions src/config.d
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ final class Config
public string configFileSyncDir = "";
public string configFileSkipFile = "";
public string configFileSkipDir = "";
public string businessSharedFolderFilePath = "";
private string userConfigFilePath = "";
private string systemConfigFilePath = "";
// was the application just authorised - paste of response uri
Expand All @@ -33,8 +34,9 @@ final class Config
private string[string] stringValues;
private bool[string] boolValues;
private long[string] longValues;
// Compile time regex - this does not change
public auto configRegex = ctRegex!(`^(\w+)\s*=\s*"(.*)"\s*$`);

this(string confdirOption)
{
// default configuration - entries in config file ~/.config/onedrive/config
Expand Down Expand Up @@ -100,6 +102,8 @@ final class Config
// AD Endpoint: https://login.chinacloudapi.cn
// Graph Endpoint: https://microsoftgraph.chinacloudapi.cn
stringValues["azure_ad_endpoint"] = "";
// Allow enable / disable of the syncing of OneDrive Business Shared Folders via configuration file
boolValues["sync_business_shared_folders"] = false;

// DEVELOPER OPTIONS
// display_memory = true | false
Expand Down Expand Up @@ -189,6 +193,7 @@ final class Config
userConfigFilePath = buildNormalizedPath(configDirName ~ "/config");
syncListFilePath = buildNormalizedPath(configDirName ~ "/sync_list");
systemConfigFilePath = buildNormalizedPath(systemConfigDirName ~ "/config");
businessSharedFolderFilePath = buildNormalizedPath(configDirName ~ "/business_shared_folders");

// Debug Output for application set variables based on configDirName
log.vdebug("refreshTokenFilePath = ", refreshTokenFilePath);
Expand All @@ -199,6 +204,7 @@ final class Config
log.vdebug("userConfigFilePath = ", userConfigFilePath);
log.vdebug("syncListFilePath = ", syncListFilePath);
log.vdebug("systemConfigFilePath = ", systemConfigFilePath);
log.vdebug("businessSharedFolderFilePath = ", businessSharedFolderFilePath);
}

bool initialize()
Expand Down Expand Up @@ -259,13 +265,16 @@ final class Config
boolValues["force"] = false;
boolValues["remove_source_files"] = false;
boolValues["skip_dir_strict_match"] = false;

boolValues["list_business_shared_folders"] = false;

// Application Startup option validation
try {
string tmpStr;
bool tmpBol;
long tmpVerb;
// duplicated from main.d to get full help output!
auto opt = getopt(

args,
std.getopt.config.bundling,
std.getopt.config.caseSensitive,
Expand Down Expand Up @@ -404,7 +413,6 @@ final class Config
"user-agent",
"Specify a User Agent string to the http client",
&stringValues["user_agent"],
// duplicated from main.d to get full help output!
"confdir",
"Set the directory used to store the configuration files",
&tmpStr,
Expand All @@ -413,7 +421,13 @@ final class Config
&tmpVerb,
"version",
"Print the version and exit",
&tmpBol
&tmpBol,
"list-shared-folders",
"List OneDrive Business Shared Folders",
&boolValues["list_business_shared_folders"],
"sync-shared-folders",
"Sync OneDrive Business Shared Folders",
&boolValues["sync_business_shared_folders"]
);
if (opt.helpWanted) {
outputLongHelp(opt.options);
Expand Down
43 changes: 36 additions & 7 deletions src/itemdb.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import std.datetime;
import std.exception;
import std.path;
import std.string;
import std.stdio;
import std.algorithm.searching;
import core.stdc.stdlib;
import sqlite;
static import log;
Expand Down Expand Up @@ -368,9 +370,14 @@ final class ItemDatabase
if (r2.empty) {
// root reached
assert(path.length >= 4);
// remove "root"
if (path.length >= 5) path = path[5 .. $];
else path = path[4 .. $];
// remove "root/" from path string if it exists
if (path.length >= 5) {
if (canFind(path, "root/")){
path = path[5 .. $];
}
abraunegg marked this conversation as resolved.
Show resolved Hide resolved
} else {
path = path[4 .. $];
}
// special case of computing the path of the root itself
if (path.length == 0) path = ".";
break;
Expand Down Expand Up @@ -427,17 +434,39 @@ final class ItemDatabase
// As we query /children to get all children from OneDrive, update anything in the database
// to be flagged as not-in-sync, thus, we can use that flag to determing what was previously
// in-sync, but now deleted on OneDrive
void downgradeSyncStatusFlag()
void downgradeSyncStatusFlag(const(char)[] driveId, const(char)[] id)
{
db.exec("UPDATE item SET syncStatus = 'N'");
assert(driveId);
auto stmt = db.prepare("UPDATE item SET syncStatus = 'N' WHERE driveId = ?1 AND id = ?2");
stmt.bind(1, driveId);
stmt.bind(2, id);
stmt.exec();
}

// National Cloud Deployments (US and DE) do not support /delta as a query
// Select items that have a out-of-sync flag set
Item[] selectOutOfSyncItems()
Item[] selectOutOfSyncItems(const(char)[] driveId)
{
assert(driveId);
Item[] items;
auto stmt = db.prepare("SELECT * FROM item WHERE syncStatus = 'N'");
auto stmt = db.prepare("SELECT * FROM item WHERE syncStatus = 'N' AND driveId = ?1");
stmt.bind(1, driveId);
auto res = stmt.exec();
while (!res.empty) {
items ~= buildItem(res);
res.step();
}
return items;
}

// OneDrive Business Folders are stored in the database potentially without a root | parentRoot link
// Select items associated with the provided driveId
Item[] selectByDriveId(const(char)[] driveId)
{
assert(driveId);
Item[] items;
auto stmt = db.prepare("SELECT * FROM item WHERE driveId = ?1 AND parentId IS NULL");
stmt.bind(1, driveId);
auto res = stmt.exec();
while (!res.empty) {
items ~= buildItem(res);
Expand Down
Loading