I'm trying to synchronize calendar events from Outlook with events from my web application.
From what I've gathered, I should use the delta() function on the calendarView
ressource.
This requires that a time range to be specified, so the changes will be tracked only for this time range.
So in the code I would do my initial delta request like this:
_appClient.users().byUserId(user_id).calendarView().delta().get(requestConfiguration -> {
requestConfiguration.queryParameters.startDateTime = "2025-01-01T00:00:00Z";
requestConfiguration.queryParameters.endDateTime = "2025-02-01T00:00:00Z";
});
I can process the received events and store the delta token.
This delta token is then used to do the next request, fetching only incremental changes, like so:
DeltaRequestBuilder deltaRequestBuilder = new DeltaRequestBuilder(delta_state, _appClient.getRequestAdapter());
deltaRequestBuilder.get();
In this example I set the time range for the month of january, but this time range will surely become out of date as the time passes. Is there a way we can shift this time range without doing an initial delta request ?
It seems to me that the time range on which we want to track changes is actually stored in the delta state. If I try to fetch the changes using a delta state and specifying a new time range, the new time range is not taken into account:
DeltaRequestBuilder deltaRequestBuilder =
deltaRequestBuilder.get(requestConfiguration -> {
requestConfiguration.queryParameters.startDateTime = "2025-02-01T00:00:00Z";
requestConfiguration.queryParameters.endDateTime = "2025-03-01T00:00:00Z";
});
deltaRequestBuilder.get();
// The specified time range is ignored
I could simply put a very big time range spanning multiple years, but that doesn't seem like good idea since all occurences of reccuring events are listed.
Note: I'm using the java sdk