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

Sync folders shared by others in onedrive business #459

Closed
uumas opened this issue Apr 8, 2019 · 73 comments · Fixed by #473
Closed

Sync folders shared by others in onedrive business #459

uumas opened this issue Apr 8, 2019 · 73 comments · Fixed by #473
Assignees
Labels
Feature Request Feature Request | Enhancement Request Implemented OneDrive Business
Milestone

Comments

@uumas
Copy link

uumas commented Apr 8, 2019

I have been unable to find a way to synchronize folders shared with me by other people in onedrive business. I don't want to sync a site or team folder, but just a folder shared with me. Is this possible currently and could it possibly be implemented?

@abraunegg
Copy link
Owner

@uumas
Are these 'shared folders' coming from other OneDrive Business / SharePoint / Office 365 accounts or from OneDrive Personal accounts?

@abraunegg abraunegg added Feature Request Feature Request | Enhancement Request Future Work - Planning Required labels Apr 8, 2019
@uumas
Copy link
Author

uumas commented Apr 9, 2019

Business accounts. I know it could never work across personal and business accounts unless microsoft changes something.

@abraunegg
Copy link
Owner

@uumas
Currently the client only supports OneDrive Personal Shared Folders.

OneDrive Business Shared Folders will be looked at in the future.

@abraunegg
Copy link
Owner

@uumas
Please can you help test the following PR:

git clone https://github.com/abraunegg/onedrive.git
cd onedrive
git fetch origin pull/473/head:pr473
git checkout pr473
make clean; make;

Note: This PR should be considered BETA quality as I have only tested this against use basic use cases.

Please refer to #473 (comment) on how to configure & use this feature.

@abraunegg abraunegg self-assigned this Apr 23, 2019
@abraunegg
Copy link
Owner

@uumas
Any update in being able to test the PR for this feature request?

@uumas
Copy link
Author

uumas commented Apr 28, 2019

Sorry for not noticing this until now. Had my old email set in github so didn't get the notificiations.

The listing of shared folders works fine, but syncing seems to do nothing. It outputs this with the verbose flag, but no files appear to be synced:

Syncing OneDrive Business Shared Folder: XXXXX
Applying changes of Path ID: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Syncing OneDrive Business Shared Folder: YYYYYYY
Applying changes of Path ID: YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY

@abraunegg
Copy link
Owner

@uumas
Can you provide more details as to what is not working?

Can you see what is happening when using --verbose and maybe even --verbose --verbose?

@uumas
Copy link
Author

uumas commented Apr 29, 2019

With one verbose flag, I only got the relevant lines I already posted. Everything relevant with two verbose flags:

...

[DEBUG] Loading user configured business_shared_folders file ...
[DEBUG] business_shared_folders: KE3
[DEBUG] business_shared_folders: KKE

...

Syncing OneDrive Business Shared Folder: XXXXX
Applying changes of Path ID: XXXXXXXXXXXXXXXXXXXXXXXXXX
[DEBUG] OneDrive Path Details: {"@odata.context":"https:\/\/graph.microsoft.com\/v1.0\/$metadata#drives('b%2XXXXXX0e_kdrmfBbOLicTQN5Zox5GhQJmAWP1a56DXXXXXXXpOTAU7Zr')\/items\/$entity","@odata.etag":"\"{XXXXXXX-0523-489C-A05E-XXXXXXXXXXXX},2\"","cTag":"\"c:{XXXXXXXX-0523-489C-A05E-34E4A156E091},0\"","eTag":"\"{XXXXXXX-0523-489C-A05E-XXXXXXXXXXXX},2\"","fileSystemInfo":{"createdDateTime":"2016-08-23T17:03:34Z","lastModifiedDateTime":"2016-08-23T17:03:34Z"},"folder":{"childCount":7},"id":"XXXXXXXXXXXXXXXXXX","name":"XXXXX","parentReference":{"driveId":"b!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","driveType":"business","id":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx","path":"\/drives\/b!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx\/root:\/XXXXXXX"},"size":XXXXX}
[DEBUG] Sync Folder Name:       KE3
[DEBUG] Sync Folder Path:       /drives/b!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/root:/Opetus
[DEBUG] Sync Folder Child Path: /drives/b!97XbV7BWO0e_kdrmfBbOLicTQN5Zox5GhQJmAWP1a56DmRzazHGvTLrgpOTAU7Zr/root:/Opetus/KE3/
[DEBUG] Selected to use onedrive.viewChangesByDriveId
[DEBUG] Number of changes from OneDrive to process: 1
[DEBUG] ------------------------------------------------------------------
[DEBUG] OneDrive Change: {"@odata.type":"#microsoft.graph.driveItem","fileSystemInfo":{"createdDateTime":"2013-08-20T12:39:17Z","lastModifiedDateTime":"2019-04-25T19:06:34Z"},"folder":{"childCount":54},"id":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","name":"root","parentReference":{"driveId":"b!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","driveType":"business"},"root":{},"size":XXXXXX}
[DEBUG] Not a OneDrive deleted item change
[DEBUG] defaultRootId                                        = XXXXXXXXXXx
[DEBUG] 'search id'                                          = XXXXXXXXXXXXXXXXXx
[DEBUG] id == defaultRootId                                  = false
[DEBUG] isItemRoot(item)                                     = true
[DEBUG] item['name'].str == 'root'                           = true
[DEBUG] singleDirectoryScope                                 = false
[DEBUG] isRoot                                               = false
[DEBUG] !hasParentReferenceId(item)                          = true
[DEBUG] isItemDeleted(item)                                  = false
[DEBUG] Handling change as 'root item', has no parent reference or is a deleted item
[DEBUG] Handing a OneDrive 'root' change
[DEBUG] Update/Insert local database with item details
[DEBUG] item details: Item("b!XXXXXXXXXXXXXXXXXXXXXXXXXx", "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "root", dir, "", "", 2019-Apr-25 19:06:34Z, "", "", "", "", "", "")
Syncing OneDrive Business Shared Folder: KKE
Applying changes of Path ID: XXXXXXXXXXXXXXXXXXXXXXXXx
[DEBUG] OneDrive Path Details: {"@odata.context":"https:\/\/graph.microsoft.com\/v1.0\/$metadata#drives('b%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx-m')\/items\/$entity","@odata.etag":"\"{XXXXX-D268-42AC-AF27-XXXXXXXXXXXX},1\"","cTag":"\"c:{XXXXXXXXXx-D268-42AC-AF27-1C4FCCB913FB},0\"","eTag":"\"{BBF2F010-D268-42AC-AF27-XXXXXXXXXx},1\"","fileSystemInfo":{"createdDateTime":"2018-11-01T07:38:47Z","lastModifiedDateTime":"2018-11-01T07:38:47Z"},"folder":{"childCount":2},"id":"XXXXXXXXXXXXXXXXXXXXXXXx","name":"KKE","parentReference":{"driveId":"b!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-m","driveType":"business","id":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","path":"\/drives\/b!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-m\/root:\/OPO-kurssi"},"size":1022694}
[DEBUG] Sync Folder Name:       KKE
[DEBUG] Sync Folder Path:       /drives/b!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-m/root:/OPO-kurssi
[DEBUG] Sync Folder Child Path: /drives/b!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-m/root:/OPO-kurssi/KKE/
[DEBUG] Selected to use onedrive.viewChangesByDriveId
[DEBUG] Number of changes from OneDrive to process: 1
[DEBUG] ------------------------------------------------------------------
[DEBUG] OneDrive Change: {"@odata.type":"#microsoft.graph.driveItem","fileSystemInfo":{"createdDateTime":"2017-08-03T21:03:46Z","lastModifiedDateTime":"2019-04-29T08:32:05Z"},"folder":{"childCount":20},"id":"XXXXXXXXXXXXXXXXXXXXXXXxxx","name":"root","parentReference":{"driveId":"b!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-m","driveType":"business"},"root":{},"size":985701734}
[DEBUG] Not a OneDrive deleted item change
[DEBUG] defaultRootId                                        = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[DEBUG] 'search id'                                          = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[DEBUG] id == defaultRootId                                  = false
[DEBUG] isItemRoot(item)                                     = true
[DEBUG] item['name'].str == 'root'                           = true
[DEBUG] singleDirectoryScope                                 = false
[DEBUG] isRoot                                               = false
[DEBUG] !hasParentReferenceId(item)                          = true
[DEBUG] isItemDeleted(item)                                  = false
[DEBUG] Handling change as 'root item', has no parent reference or is a deleted item
[DEBUG] Handing a OneDrive 'root' change
[DEBUG] Update/Insert local database with item details
[DEBUG] item details: Item("b!XXXXXXXXXXXXXXXXXXXXXXXXXXXX-m", "XXXXXXXXXXXXXXXXXXXXXXXXXX", "root", dir, "", "", 2019-Apr-29 08:32:05Z, "", "", "", "", "", "")

...

[DEBUG] OneDrive Path Details: {"@odata.context":"https:\/\/graph.microsoft.com\/v1.0\/$metadata#drives('b%2XXXXXX0e_kdrmfBbOLicTQN5Zox5GhQJmAWP1a56DXXXXXXXpOTAU7Zr')\/items\/$entity","@odata.etag":"\"{XXXXXXX-0523-489C-A05E-XXXXXXXXXXXX},2\"","cTag":"\"c:{XXXXXXXX-0523-489C-A05E-34E4A156E091},0\"","eTag":"\"{XXXXXXX-0523-489C-A05E-XXXXXXXXXXXX},2\"","fileSystemInfo":{"createdDateTime":"2016-08-23T17:03:34Z","lastModifiedDateTime":"2016-08-23T17:03:34Z"},"folder":{"childCount":7},"id":"XXXXXXXXXXXXXXXXXX","name":"XXXXX","parentReference":{"driveId":"b!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","driveType":"business","id":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx","path":"\/drives\/b!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx\/root:\/XXXXXXX"},"size":XXXXX}
[DEBUG] Sync Folder Name:       KE3
[DEBUG] Sync Folder Path:       /drives/b!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/root:/Opetus
[DEBUG] Sync Folder Child Path: /drives/b!97XbV7BWO0e_kdrmfBbOLicTQN5Zox5GhQJmAWP1a56DmRzazHGvTLrgpOTAU7Zr/root:/Opetus/KE3/
[DEBUG] Selected to use onedrive.viewChangesByDriveId
[DEBUG] Number of changes from OneDrive to process: 1
[DEBUG] ------------------------------------------------------------------
[DEBUG] OneDrive Change: {"@odata.type":"#microsoft.graph.driveItem","fileSystemInfo":{"createdDateTime":"2013-08-20T12:39:17Z","lastModifiedDateTime":"2019-04-25T19:06:34Z"},"folder":{"childCount":54},"id":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","name":"root","parentReference":{"driveId":"b!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","driveType":"business"},"root":{},"size":XXXXXX}
[DEBUG] Not a OneDrive deleted item change
[DEBUG] defaultRootId                                        = XXXXXXXXXXx
[DEBUG] 'search id'                                          = XXXXXXXXXXXXXXXXXx
[DEBUG] id == defaultRootId                                  = false
[DEBUG] isItemRoot(item)                                     = true
[DEBUG] item['name'].str == 'root'                           = true
[DEBUG] singleDirectoryScope                                 = false
[DEBUG] isRoot                                               = false
[DEBUG] !hasParentReferenceId(item)                          = true
[DEBUG] isItemDeleted(item)                                  = false
[DEBUG] Handling change as 'root item', has no parent reference or is a deleted item
[DEBUG] Handing a OneDrive 'root' change
[DEBUG] Update/Insert local database with item details
[DEBUG] item details: Item("b!XXXXXXXXXXXXXXXXXXXXXXXXXx", "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "root", dir, "", "", 2019-Apr-25 19:06:34Z, "", "", "", "", "", "")
Syncing OneDrive Business Shared Folder: KKE
Applying changes of Path ID: XXXXXXXXXXXXXXXXXXXXXXXXx
[DEBUG] OneDrive Path Details: {"@odata.context":"https:\/\/graph.microsoft.com\/v1.0\/$metadata#drives('b%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx-m')\/items\/$entity","@odata.etag":"\"{XXXXX-D268-42AC-AF27-XXXXXXXXXXXX},1\"","cTag":"\"c:{XXXXXXXXXx-D268-42AC-AF27-1C4FCCB913FB},0\"","eTag":"\"{BBF2F010-D268-42AC-AF27-XXXXXXXXXx},1\"","fileSystemInfo":{"createdDateTime":"2018-11-01T07:38:47Z","lastModifiedDateTime":"2018-11-01T07:38:47Z"},"folder":{"childCount":2},"id":"XXXXXXXXXXXXXXXXXXXXXXXx","name":"KKE","parentReference":{"driveId":"b!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-m","driveType":"business","id":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","path":"\/drives\/b!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-m\/root:\/OPO-kurssi"},"size":1022694}
[DEBUG] Sync Folder Name:       KKE
[DEBUG] Sync Folder Path:       /drives/b!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-m/root:/OPO-kurssi
[DEBUG] Sync Folder Child Path: /drives/b!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-m/root:/OPO-kurssi/KKE/
[DEBUG] Selected to use onedrive.viewChangesByDriveId
[DEBUG] Number of changes from OneDrive to process: 1
[DEBUG] ------------------------------------------------------------------
[DEBUG] OneDrive Change: {"@odata.type":"#microsoft.graph.driveItem","fileSystemInfo":{"createdDateTime":"2017-08-03T21:03:46Z","lastModifiedDateTime":"2019-04-29T08:32:05Z"},"folder":{"childCount":20},"id":"XXXXXXXXXXXXXXXXXXXXXXXxxx","name":"root","parentReference":{"driveId":"b!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-m","driveType":"business"},"root":{},"size":985701734}
[DEBUG] Not a OneDrive deleted item change
[DEBUG] defaultRootId                                        = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[DEBUG] 'search id'                                          = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[DEBUG] id == defaultRootId                                  = false
[DEBUG] isItemRoot(item)                                     = true
[DEBUG] item['name'].str == 'root'                           = true
[DEBUG] singleDirectoryScope                                 = false
[DEBUG] isRoot                                               = false
[DEBUG] !hasParentReferenceId(item)                          = true
[DEBUG] isItemDeleted(item)                                  = false
[DEBUG] Handling change as 'root item', has no parent reference or is a deleted item
[DEBUG] Handing a OneDrive 'root' change
[DEBUG] Update/Insert local database with item details
[DEBUG] item details: Item("b!XXXXXXXXXXXXXXXXXXXXXXXXXXXX-m", "XXXXXXXXXXXXXXXXXXXXXXXXXX", "root", dir, "", "", 2019-Apr-29 08:32:05Z, "", "", "", "", "", "")

Let me know if you want me to email the full unsanitized output

@abraunegg
Copy link
Owner

@uumas
Yes please send the full unsanitised output to support@mynas.com.au

@abraunegg
Copy link
Owner

@uumas
Please can you provide an update using the latest PR microsoftgraph/microsoft-graph-docs#473:

git clone https://github.com/abraunegg/onedrive.git
cd onedrive
git fetch origin pull/473/head:pr473
git checkout pr473
make clean; make;

In all my testing it always sync's data to the OneDrive Shared Business folder as required.

@christiancloudical
Copy link

christiancloudical commented May 3, 2019

Hello,

I have tested that, too, unfortunatly, it is failing in my case.
'# onedrive --confdir '~/.config/onedrive-shared' --list-shared-folders
is failing with following:

std.json.JSONException@std/json.d(540): Key not found: sharedBy
'----------------
/home/christian/dlang/dmd-2.085.1/linux/bin64/../../src/phobos/std/exception.d:515 pure @safe void std.exception.bailOut!(std.json.JSONException).bailOut(immutable(char)[], ulong, scope const(char)[]) [0x5e36b7]
??:? pure @safe inout(std.json.JSONValue)* std.exception.enforce!(std.json.JSONException).enforce!(inout(std.json.JSONValue)*).enforce(inout(std.json.JSONValue)*, lazy const(char)[], immutable(char)[], ulong) [0x6817ee]
??:? inout pure ref @safe inout(std.json.JSONValue) std.json.JSONValue.opIndex(immutable(char)[]) [0x6391dd]
src/sync.d:2875 void sync.SyncEngine.listOneDriveBusinessSharedFolders() [0x6141e5]
src/main.d:397 _Dmain [0x5f62ef]

and so, the configuration is not changed, I think:

onedrive version                    = v2.3.3-15-g785ad86
Config path                         = /home/christian/.config/onedrive-shared
Config file found in config path    = true
Config option 'check_nosync'        = false
Config option 'sync_dir'            = /home/christian/onedrive-shared
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 = false

@abraunegg , I am not able to update the other case, and sorry for delay ;)

@abraunegg
Copy link
Owner

@christiancloudibility
Can you please use the following command with the version you have built:

onedrive --confdir '~/.config/onedrive-shared' --list-shared-folders --verbose --verbose

@christiancloudical
Copy link

christiancloudical commented May 3, 2019

[DEBUG] homePath: HOME environment variable set
[DEBUG] homePath: /home/christian
[DEBUG] configDirName: CLI override to set configDirName to: ~/.config/onedrive-shared
[DEBUG] configDirName: A '~' was found in configDirName, using the calculated 'homePath' to replace '~'
Using Config Dir: /home/christian/.config/onedrive-shared
[DEBUG] sync_dir: Getting syncDir from config value sync_dir
[DEBUG] syncDir: /home/christian/onedrive-shared
Initializing the OneDrive API ...
Opening the item database ...
[DEBUG] Using database file: /home/christian/.config/onedrive-shared/items.sqlite3
All operations will be performed in: /home/christian/onedrive-shared
[DEBUG] Configuring skip_dir ...
[DEBUG] skip_dir: 
[DEBUG] Configuring skip_file ...
[DEBUG] skip_file: ~*|.~*|*.tmp
Initializing the Synchronization Engine ...
[DEBUG] OneDrive Account Details:      {"@odata.context":"https:\/\/graph.microsoft.com\/v1.0\/$metadata#drives\/$entity","createdBy":{"user":{"displayName":"Systemkonto"}},"createdDateTime":"2018-11-22T09:30:33Z","description":"","driveType":"business","id":"b!h8tDB139aEuYrx-AOoBLUlcPwiOLZx5FhdwpCMfKy-g4C83J7gsvQIwy4q83F8ji","lastModifiedBy":{"user":{"displayName":"Christian Schilling","email":"christian@cloudibility.io","id":"d031436b-023b-4ecb-b6a9-b7ba97772f26"}},"lastModifiedDateTime":"2019-04-30T15:22:26Z","name":"OneDrive","owner":{"user":{"displayName":"Christian Schilling","email":"christian@cloudibility.io","id":"d031436b-023b-4ecb-b6a9-b7ba97772f26"}},"quota":{"deleted":2028028890,"remaining":1087616854504,"state":"normal","total":1099511627776,"used":9801990366},"webUrl":"https:\/\/cloudibilityag-my.sharepoint.com\/personal\/christian_cloudibility_io\/Documents"}
[DEBUG] OneDrive Account Root Details: {"@odata.context":"https:\/\/graph.microsoft.com\/v1.0\/$metadata#users('d031436b-023b-4ecb-b6a9-b7ba97772f26')\/drive\/root\/$entity","createdDateTime":"2018-11-22T09:30:33Z","fileSystemInfo":{"createdDateTime":"2018-11-22T09:30:33Z","lastModifiedDateTime":"2019-05-03T06:12:23Z"},"folder":{"childCount":23},"id":"01TZXM6756Y2GOVW7725BZO354PWSELRRZ","lastModifiedDateTime":"2019-05-03T06:12:23Z","name":"root","parentReference":{"driveId":"b!h8tDB139aEuYrx-AOoBLUlcPwiOLZx5FhdwpCMfKy-g4C83J7gsvQIwy4q83F8ji","driveType":"business"},"root":{},"size":9801990366,"webUrl":"https:\/\/cloudibilityag-my.sharepoint.com\/personal\/christian_cloudibility_io\/Documents"}
Account Type: business
Default Drive ID: b!h8tDB139aEuYrx-AOoBLUlcPwiOLZx5FhdwpCMfKy-g4C83J7gsvQIwy4q83F8ji
Default Root ID: 01TZXM6756Y2GOVW7725BZO354PWSELRRZ
Remaining Free Space: 1087616854504
Fetching details for OneDrive Root
OneDrive Root exists in the database```

Listing available OneDrive Business Shared Folders:
'---------------------------------------
some shared stuff ...
...

std.json.JSONException@std/json.d(540): Key not found: sharedBy
'----------------
/home/christian/dlang/dmd-2.085.1/linux/bin64/../../src/phobos/std/exception.d:515 pure @safe void std.exception.bailOut!(std.json.JSONException).bailOut(immutable(char)[], ulong, scope const(char)[]) [0x5e36b7]
??:? pure @safe inout(std.json.JSONValue)* std.exception.enforce!(std.json.JSONException).enforce!(inout(std.json.JSONValue)*).enforce(inout(std.json.JSONValue)*, lazy const(char)[], immutable(char)[], ulong) [0x6817ee]
??:? inout pure ref @safe inout(std.json.JSONValue) std.json.JSONValue.opIndex(immutable(char)[]) [0x6391dd]
src/sync.d:2875 void sync.SyncEngine.listOneDriveBusinessSharedFolders() [0x6141e5]
src/main.d:397 _Dmain [0x5f62ef]

@abraunegg
Copy link
Owner

@christiancloudibility
OK - for whatever reason - your shared folders are missing the details of who is sharing that with you .. so will make conflict resolution tough.

Please can you rebuild your client - you should now get v2.3.3-16-g16a0865 as the version.

Please try then first:

onedrive --confdir '~/.config/onedrive-shared' --list-shared-folders --verbose

and if that still fails:

onedrive --confdir '~/.config/onedrive-shared' --list-shared-folders --verbose --verbose

@christiancloudical
Copy link

christiancloudical commented May 3, 2019

The last Folder is making trouble, as it seems.
But even in OneDrive, I can not the the "shared by" or "date shared" information.
Maybe - Just a thought, don't know who created that folder:
could it be, that it is problematic, if someone shares a folder or file he is not the owner off?

because that last folder has two different shared by information, one by jurlind, one by anna

[DEBUG] shared folder entry: {"@odata.type":"#microsoft.graph.driveItem","createdBy":{"user":{"displayName":"Jurlind Budurushi","email":"jurlind@cloudibility.io"}},"createdDateTime":"2019-01-30T13:07:54Z","fileSystemInfo":{"createdDateTime":"2019-01-30T13:07:54Z","lastModifiedDateTime":"2019-01-30T13:13:42Z"},"folder":{"childCount":0},"id":"01RWWVIQ6WW7W6LFV7RNALO3TBFHSPAYHS","lastModifiedBy":{"user":{"displayName":"Jurlind Budurushi","email":"jurlind@cloudibility.io"}},"lastModifiedDateTime":"2019-01-30T13:13:42Z","name":"RefrencedDocuments","remoteItem":{"createdBy":{"user":{"displayName":"Jurlind Budurushi","email":"jurlind@cloudibility.io"}},"createdDateTime":"2019-01-30T13:07:54Z","fileSystemInfo":{"createdDateTime":"2019-01-30T13:07:54Z","lastModifiedDateTime":"2019-01-30T13:13:42Z"},"folder":{"childCount":0},"id":"01RWWVIQ6WW7W6LFV7RNALO3TBFHSPAYHS","lastModifiedBy":{"user":{"displayName":"Jurlind Budurushi","email":"jurlind@cloudibility.io"}},"lastModifiedDateTime":"2019-01-30T13:13:42Z","name":"RefrencedDocuments","parentReference":{"driveId":"b!PFOC6kIhwUuHdlhJGjDl9lcPwiOLZx5FhdwpCMfKy-g4C83J7gsvQIwy4q83F8ji","driveType":"business"},"shared":{"scope":"users","sharedDateTime":"0001-01-01T08:00:00Z"},"sharepointIds":{"listId":"c9cd0b38-0bee-402f-8c32-e2af3717c8e2","listItemId":"130","listItemUniqueId":"e5edb7d6-bf96-408b-b76e-6129e4f060f2","siteId":"ea82533c-2142-4bc1-8776-58491a30e5f6","siteUrl":"\/personal\/jurlind_cloudibility_io","webId":"23c20f57-678b-451e-85dc-2908c7cacbe8"},"size":0,"webDavUrl":"https:\/\/cloudibilityag-my.sharepoint.com\/personal\/jurlind_cloudibility_io\/Documents\/Eumetsat\/ICSI%20-%20Verification%20Test%20Cases%20and%20Procedures%20v10\/ExchangewithEumetsat\/ICSI%20-%20Verification%20Test%20Cases%20and%20Procedures%20v1.01\/RefrencedDocuments","webUrl":"https:\/\/cloudibilityag-my.sharepoint.com\/personal\/jurlind_cloudibility_io\/Documents\/Eumetsat\/ICSI%20-%20Verification%20Test%20Cases%20and%20Procedures%20v10\/ExchangewithEumetsat\/ICSI%20-%20Verification%20Test%20Cases%20and%20Procedures%20v1.01\/RefrencedDocuments"},"size":0,"webUrl":"https:\/\/cloudibilityag-my.sharepoint.com\/personal\/jurlind_cloudibility_io\/Documents\/Eumetsat\/ICSI%20-%20Verification%20Test%20Cases%20and%20Procedures%20v10\/ExchangewithEumetsat\/ICSI%20-%20Verification%20Test%20Cases%20and%20Procedures%20v1.01\/RefrencedDocuments"}
'---------------------------------------
Shared Folder:   RefrencedDocuments
Shared By:       Anna Filipiak (anna@cloudibility.io)
Item Id:         01RWWVIQ6WW7W6LFV7RNALO3TBFHSPAYHS
Parent Drive Id: b!PFOC6kIhwUuHdlhJGjDl9lcPwiOLZx5FhdwpCMfKy-g4C83J7gsvQIwy4q83F8ji
std.json.JSONException@std/json.d(540): Key not found: id
'----------------
/home/christian/dlang/dmd-2.085.1/linux/bin64/../../src/phobos/std/exception.d:515 pure @safe void std.exception.bailOut!(std.json.JSONException).bailOut(immutable(char)[], ulong, scope const(char)[]) [0x5e36b7]
??:? pure @safe inout(std.json.JSONValue)* std.exception.enforce!(std.json.JSONException).enforce!(inout(std.json.JSONValue)*).enforce(inout(std.json.JSONValue)*, lazy const(char)[], immutable(char)[], ulong) [0x681a8e]
??:? inout pure ref @safe inout(std.json.JSONValue) std.json.JSONValue.opIndex(immutable(char)[]) [0x63947d]
src/sync.d:2914 void sync.SyncEngine.listOneDriveBusinessSharedFolders() [0x614b38]
src/main.d:397 _Dmain [0x5f62ef]

@abraunegg
Copy link
Owner

abraunegg commented May 3, 2019

@christiancloudibility
OK .. it is now failing on a different error

Please can you rebuild your client - you should now get v2.3.3-17-g38e9332 as the version.

Please try then first:

onedrive --confdir '~/.config/onedrive-shared' --list-shared-folders --verbose

and if that still fails:

onedrive --confdir '~/.config/onedrive-shared' --list-shared-folders --verbose --verbose

Also - to make reading log output easier - please can you format correctly by using 3 x backticks (```) in a row then the log starting on the next line, then finish on a new line with 3 x backticks as well

This way the logs format correctly

@christiancloudical
Copy link

@abraunegg ok thanks, didn't got it formated nice^^

Now there is no more error, looks like the list is working fine now!
But still, the configuration is not changed, do I have to add anything to ~/.config/onedrive-shared/config file?

onedrive --confdir '~/.config/onedrive-shared' --display-config
onedrive version                    = v2.3.3-17-g38e9332
Config path                         = /home/christian/.config/onedrive-shared
Config file found in config path    = true
Config option 'check_nosync'        = false
Config option 'sync_dir'            = /home/christian/onedrive-shared
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 = false

@abraunegg
Copy link
Owner

@christiancloudibility
To configure the new feature, follow the following readme:

https://github.com/abraunegg/onedrive/blob/onedrive-business-shared_folders/README.BusinessSharedFolders.md

@config-i1
Copy link

This is helpful. For some reason, I couldn't find this guide.

Is it possible to sync all the shared files and folders to a separate folder, e.g. "OneDrive/Shared"?
The creation of files and the download works well. I'll test the upload.

@config-i1
Copy link

A few things that I've spotted:

  1. It does not see the folders shared with me by the external organisations
  2. It does not sync the shared files (not folders). At least, it didn't work for me.

But in general sync seems to work with proper uploads / downloads.

Anything specific to test?

@abraunegg
Copy link
Owner

A few things that I've spotted:

  1. It does not see the folders shared with me by the external organisations
  2. It does not sync the shared files (not folders). At least, it didn't work for me.

But in general sync seems to work with proper uploads / downloads.

Anything specific to test?

For each of the above please email a verbose debug log without any redaction, so that this can be analysed and walked through.

When I last tested this (probably 12 months ago) this was all working - perhaps something has broken because I have been maintaining this as a PR but without testing - and without anyone actually providing feedback - hard to know if something is broken or not.

@abraunegg abraunegg changed the title Sync folders shared by others in onedrive business (PR #473 - on-hold) Sync folders shared by others in onedrive business Jun 18, 2020
@abraunegg abraunegg added In Progress Currently being worked on and removed OneDrive API Blocker An API issue prevents further work at this point in time labels Jun 18, 2020
@abraunegg
Copy link
Owner

Update on this feature - currently in-progress of fixing outstanding issues. Expect a new version shortly for testing, with a view to include this in the next release.

@abraunegg abraunegg added this to the v2.4.3 milestone Jun 18, 2020
@abraunegg
Copy link
Owner

abraunegg commented Jun 19, 2020

@uumas , @christiancloudical , @tinux7 , @config-i1 , @arthurep , @fcastilloec

This feature has been 100% overhauled, and I can confirm that this is working as expected - at least for my use cases. I plan on testing and updating as I find things to fix (again, based on my ability to have ODB test accounts is not great) , however it would be greatly appreciated if you can assist as well in testing this feature out.

Confirmed as working:

  • Syncing (upload / download) of a OneDrive Business Shared folder (which is shared from other account root)
  • Syncing (upload / download) of a OneDrive Business Shared folder (which is shared from any location in other account)
  • Correctly handle local file deletion to remote location
  • Correctly handle remote file deletion to local location
  • Operation when using --monitor
  • Enabling option (--sync-shared-folders) via config file

To test this PR:

git clone https://github.com/abraunegg/onedrive.git
cd onedrive
git fetch origin pull/473/head:pr473
git checkout pr473
./configure; make clean; make;

The client version for the PR build should be onedrive v2.4.2-124-g49aa42c or greater.

@abraunegg abraunegg added PR Provided - Needs Testing and removed Help Wanted Extra attention is needed labels Jun 19, 2020
@config-i1
Copy link

Thanks a lot for the great work in order to implement this feature! Your program is very useful!

Now, as for the tests, I've tried installing this with a mixed success.

make clean; make;

gives me an error:

make: *** No rule to make target 'clean'. Stop.
make: *** No targets specified and no makefile found. Stop.

So I did ./configure and sudo make install instead, which seems to have worked.

As for the tested features:

  1. Syncing (upload / download) of a OneDrive Business Shared folder (which is shared from other account root) - works;
  2. Syncing (upload / download) of a OneDrive Business Shared folder (which is shared from any location in other account) - works;
  3. Correctly handle local file deletion to remote location - works;
  4. Correctly handle remove file deletion to local location - works;
  5. Operation when using --monitor - does not seem to work. Am I running this correctly?;
  6. Enabling option (--sync-shared-folders) via config file - not tested. I don't know how to do that.
  7. Syncing a OneDrive Business folder shared with me by another organisation - doesn't work. A folder shared with me from a different organisation is not shown on my hard drive;

How I did it:

  • running "onedrive --synchronize --sync-shared-folders"
  • running "onedrive --monitor"

I might be doing something wrong, but IMHO, it's a bit difficult to figure out what to do and how to do that. Also, I don't know how to do a verbose debug log without any redaction, because I'm a noob. So, I'll need your help with this if you want my feedback...

@abraunegg
Copy link
Owner

@config-i1

Many thanks for testing the updated PR. This is GREATLY appreciated.

Thanks a lot for the great work in order to implement this feature! Your program is very useful!

Now, as for the tests, I've tried installing this with a mixed success.

make clean; make;

gives me an error:

make: *** No rule to make target 'clean'. Stop.
make: *** No targets specified and no makefile found. Stop.

So I did ./configure and sudo make install instead, which seems to have worked.

Thanks .. bad copy / paste on my behalf .. updated the instructions.

  1. Operation when using --monitor - does not seem to work. Am I running this correctly?;

You will need to run this like the following:

onedrive --monitor --sync-shared-folders 

or add the following to your configuration file: https://github.com/abraunegg/onedrive/blob/onedrive-business-shared_folders/docs/BusinessSharedFolders.md#enable--disable-syncing-of-onedrive-business-shared-folders

This then negates needing to add --sync-shared-folders

  1. Syncing a OneDrive Business folder shared with me by another organisation

With this one, what does --list-shared-folders return - for example:

./onedrive --list-shared-folders
Configuration file successfully loaded
Configuring Global Azure AD Endpoints
Initializing the Synchronization Engine ...

Listing available OneDrive Business Shared Folders:
---------------------------------------
Shared Folder:   Child Shared Folder
Shared By:       test user
---------------------------------------
Shared Folder:   Top Level to Share
Shared By:       test user (testuser@mynasau3.onmicrosoft.com)

This returns what is provided via the API. If the shared folder by another organisation is not shown here, then the Microsoft Graph API is not providing the details. The client can only sync what the API provides.

Can you show me a screen shot of OneDrive WebUI showing this folder?

@abraunegg
Copy link
Owner

@config-i1

7. Syncing a OneDrive Business folder shared with me by another organisation - doesn't work. A folder shared with me from a different organisation is not shown on my hard drive;

This, as I alluded to above, might be an API issue. After some digging - appears this might be the case: https://github.com/microsoftgraph/microsoft-graph-docs-contrib/issues/7858

If so, there is not much I can do as the Graph API does not provide the details.

Screen shot and a verbose debug (see: https://github.com/abraunegg/onedrive/wiki/Generate-debug-log-for-support) for the following:

onedrive --list-shared-folders --verbose --verbose

If you can rebuild / reinstall your client - so that you get onedrive v2.4.2-138-gecf4ed7 - then the output of this command will include the full API response as provided from Microsoft.

This will then show, exactly what is being returned - and, as per https://github.com/microsoftgraph/microsoft-graph-docs-contrib/issues/7858 it most likely is an API issue

@config-i1
Copy link

config-i1 commented Jun 23, 2020

Thanks for clarification! Monitor works like a charm!

The onedrive --list-shared-folders doesn't show the folder from the external organisation. It might not be possible to do that at all. I will send you an email with the verbose outputs. Where can I find your email address though?

@abraunegg
Copy link
Owner

For email - refer to the support proceedures in the readme, or, if your google-fu is in-tune, you should be able to find me elsewhere.

@config-i1
Copy link

Cool! I've sent an email with the logs. Cheers!

@abraunegg
Copy link
Owner

@config-i1

7. Syncing a OneDrive Business folder shared with me by another organisation - doesn't work. A folder shared with me from a different organisation is not shown on my hard drive;

Confirmed that this is an API issue. Will track this here:

Raised an issue here:

Noted here:

abraunegg added a commit that referenced this issue Jun 27, 2020
* Implement OneDrive Business Shared Folders Support
@abraunegg abraunegg added Implemented and removed In Progress Currently being worked on PR Provided - Needs Testing labels Jun 27, 2020
@adam2392

This comment has been minimized.

@abraunegg

This comment has been minimized.

@adam2392

This comment has been minimized.

@abraunegg

This comment has been minimized.

Repository owner locked and limited conversation to collaborators May 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Feature Request Feature Request | Enhancement Request Implemented OneDrive Business
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants