event: delta

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported.

Get a set of events that have been added, deleted, or updated in a calendarView (a range of events) of the user's primary calendar.

A delta function call for events is similar to a GET /calendarview request for a range of dates in the user's primary calendar, except that by appropriately applying state tokens in one or more of these calls, you can query for incremental changes in that calender view. This allows you to maintain and synchronize a local store of a user's events in the primary calendar, without having to fetch all the events of that calendar from the server every time.

Permissions

One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

Permission type Permissions (from least to most privileged)
Delegated (work or school account) Calendars.Read, Calendars.ReadWrite
Delegated (personal Microsoft account) Calendars.Read, Calendars.ReadWrite
Application Calendars.Read, Calendars.ReadWrite

HTTP request

GET /me/calendarView/delta?startDateTime={start_datetime}&endDateTime={end_datetime}
GET /users/<id>/calendarView/delta?startDateTime={start_datetime}&endDateTime={end_datetime}

Query parameters

Tracking changes in events incurs a round of one or more delta function calls. If you use any query parameter (other than $deltatoken and $skiptoken), you must specify it in the initial delta request. Microsoft Graph automatically encodes any specified parameters into the token portion of the nextLink or deltaLink URL provided in the response. You only need to specify any desired query parameters once upfront. In subsequent requests, simply copy and apply the nextLink or deltaLink URL from the previous response, as that URL already includes the encoded, desired parameters.

Query parameter Type Description
startDateTime String The start date and time of the time range, represented in ISO 8601 format. For example, "2015-11-08T19:00:00.0000000".
endDateTime String The end date and time of the time range, represented in ISO 8601 format. For example, "2015-11-08T20:00:00.0000000".
$deltatoken string A state token returned in the deltaLink URL of the previous delta function call for the same calendar view, indicating the completion of that round of change tracking. Save and apply the entire deltaLink URL including this token in the first request of the next round of change tracking for that calendar view.
$skiptoken string A state token returned in the nextLink URL of the previous delta function call, indicating there are further changes to be tracked in the same calendar view.

When you do a delta query on a calendar view, expect to get all the properties you'd normally get from a GET /calendarview request. $select is not supported in this case.

Request headers

Name Type Description
Authorization string Bearer {token}. Required.
Content-Type string application/json. Required.
Prefer string odata.maxpagesize={x}. Optional.
Prefer string {Time zone}. Optional, UTC assumed if absent.

Response

If successful, this method returns a 200 OK response code and event collection object in the response body.

Example

Request

The following example shows how to make a single delta function call, and limit the maximum number of events in the response body to 2.

To track changes in a calendar view, you would make one or more delta function calls, with appropriate state tokens, to get the set of incremental changes since the last delta query.

GET https://graph.microsoft.com/beta/me/calendarview/delta?startdatetime={start_datetime}&enddatetime={end_datetime}

Prefer: odata.maxpagesize=2
Response

If the request is successful, the response would include a state token, which is either a skipToken (in an _@odata.nextLink_ response header) or a deltaToken (in an _@odata.deltaLink_ response header). Respectively, they indicate whether you should continue with the round or you have completed getting all the changes for that round.

The response below shows a skipToken in an _@odata.nextLink_ response header.

Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.

HTTP/1.1 200 OK
Content-type: application/json
Content-length: 359

{
  "@odata.nextLink":"https://graph.microsoft.com/beta/me/calendarview/delta?$skiptoken={_skipToken_}",
  "value": [
    {
      "originalStartTimeZone": "originalStartTimeZone-value",
      "originalEndTimeZone": "originalEndTimeZone-value",
      "responseStatus": {
        "response": "response-value",
        "time": "datetime-value"
      },
      "uid": "iCalUId-value",
      "reminderMinutesBeforeStart": 99,
      "isReminderOn": true
    }
  ]
}

SDK sample code


GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var queryOptions = new List<QueryOption>()
{
	new QueryOption("startdatetime", "{start_datetime}"),
	new QueryOption("enddatetime", "{end_datetime}")
};

var delta = await graphClient.Me.CalendarView.Delta()
	.Request( queryOptions )
	.GetAsync();

Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.

See also