Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I had difficulties to get syncing running with graph. Usually, with python-kopano, one would fetch folder.state and sync, thereby fetching another state. These states could be compared and respective actions could be performed.
In graph, there is no folder.state. The mailFolder Ressource simply does not know it. Therefore, the folder.state needs to be retrieved somewhere from. In the initial code, I hade to do a sync with a certain time (i.e. datetime.datetime.now()) to retrieve the latest state. However, when using this state as a deltatoken to ask for an update, something does not work. Apparently, the state is wrong. Kopano seems to hang. Hence, I modified the code to allow for returning an initial deltatoken for the first messages/delta (i.e. without any token). Thus, in analogy to the python-kopano way, one would do a messages/delta first retrieving a token and then provide that token to the next delta request.
I don't know whether this is the intended way of MS Graph, i.e. whether a simple messages/delta returns the current state of the folder or the oldest state of the folder. The modified code returns the current state.