GraphNotification manages Microsoft Graph change notifications for mail messages or calendar events. It supports two modes:
{endPoint}/4dnk-graph-notification?state={uuid}.A GraphNotification object is obtained by calling .notifier() on an Office365Calendar object, or .notifier() on an Office365Mail object. Call start() to begin monitoring and stop() to end it.
Callbacks (onCreate, onDelete, onModify) are dispatched in the 4D worker where .start() was originally called. The subscription is automatically closed when the notifier object is destroyed.
A GraphNotification object exposes the following properties:
| Property | Type | Description |
|---|---|---|
| endPoint | Text | (read-only) Webhook URL configured at construction. Empty string in pull mode. |
| expiration | Text | (read-only) ISO 8601 expiration date/time of the current Graph subscription. Empty string in pull mode or before start() is called. |
| isStarted | Boolean | (read-only) true when monitoring is active. |
| timer | Integer | (read-only) Pull polling interval in seconds (default: 30; pull mode only). |
.start() : Object
| Parameter | Type | Description | |
|---|---|---|---|
| Result | Object | <- | Status object with success (Boolean), statusText (Text), and errors (Collection). |
.start() activates change notifications.
endPoint set): creates a Graph subscription via POST /subscriptions; starts a background worker monitoring loop that renews the subscription before expiration.endPoint): immediately starts the polling worker loop using delta queries.No-op when already started.
.stop() : Object
| Parameter | Type | Description | |
|---|---|---|---|
| Result | Object | <- | Status object with success (Boolean), statusText (Text), and errors (Collection). |
.stop() stops change notifications.
DELETE /subscriptions/{id}; kills the monitor worker; cleans up Storage.No-op when not started.
Calendar notifications via delta polling every 60 seconds (pull mode):
$calNotif:=$office365.calendar.notifier({ \
timer: 60; \
onCreate: Formula(handleNewEvent($1; $2)); \
onModify: Formula(handleEventUpdate($1; $2)) \
})
$status:=$calNotif.start()
// Stop monitoring
$status:=$calNotif.stop()
Mail notifications via webhook (push mode):
var $notif:=$office365.mail.notifier({ \
endPoint: "https://myserver.com"; \
onCreate: Formula(ALERT("New mail: "+String($2.ids))); \
onDelete: Formula(ALERT("Mail deleted: "+String($2.ids))) \
})
$status:=$notif.start()