0

Currently I am experiencing an issue with delta mechanism for OneDrive in the Graph API. I have encountered a situation where moving a folder results in missing events when querying the delta endpoint.

Here is an example scenario:

--> DT_null --> Initial request -->
[]
--> DT0

1. Create initial structure:
Folder1/Folder2_copyme/file_to_copy.txt
Folder_move_to_me/

--> DT0 --> Initial request -->
`Folder1/`
`Folder2_copyme/`
`Folder_move_to_me/`
`Folder1/Folder2_copyme/file_to_copy.txt`
--> DT1

2. Copy `Folder2_copyme` to root folder
structure:
Folder1/Folder2_copyme/file_to_copy.txt
Folder2_copyme/file_to_copy.txt
Folder_move_to_me/


--> DT0 --> Request delta
`Folder1/`
`Folder2_copyme/`
`Folder_move_to_me/`
`Folder1/Folder2_copyme/file_to_copy.txt`
`Folder2_copyme/file_to_copy.txt`
--> DT2

3. Move `Folder2_copyme` from root folder to `Folder_move_to_me`
structure:
Folder1/Folder2_copyme/file_to_copy.txt
Folder_move_to_me/Folder2_copyme/file_to_copy.txt

--> DT0 --> Request delta
`Folder1/`
`Folder_move_to_me/`
`Folder1/Folder2_copyme/file_to_copy.txt`
`Folder_move_to_me/Folder2_copyme/`
?? where `Folder_move_to_me/Folder2_copyme/file_to_copy.txt` ???
--> DT3

Why is file_to_copy.txt missing from the event log in the final request? This can be reproduced using the graph explorer tool.

codinglizard
  • 63
  • 1
  • 7

1 Answers1

0

Unfortunately a change to a parent, even if that change is a rename, will not result in delta returning information about the descendants. The delta API is of greatest use when clients maintain their own view of the world, including the hierarchy, and merges changes reported by the server into that view. That way when a parent is renamed the client instinctively knows that it'll result in changes to the paths of all children, but not the children themselves.

Here's a previous answer on implementing sync using delta that may be of use: Correct way to use OneDrive API to sync files

Brad
  • 4,089
  • 2
  • 16
  • 26
  • Updated the original question for better clarity on the issue. – codinglizard May 07 '19 at 10:47
  • I have reviewed the algorithm you posted and have an additional question. In my algorithm it requires at least one file level event in the delta (e.g. creation) for it to enter into the system. After this I am able to correctly update the relationships (local tree) based off the changes I receive. In the scenario I describe above, however, this approach falls apart (the file creation event is lost or collapsed). @Brad How does the algorithm you describe handle this scenario? – codinglizard May 08 '19 at 19:43