@memberjunction/communication-ms-graph 6.1.0-edge.4 → 6.1.0-edge.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -1
- package/dist/MSGraphProvider.d.ts +52 -1
- package/dist/MSGraphProvider.d.ts.map +1 -1
- package/dist/MSGraphProvider.js +226 -38
- package/dist/MSGraphProvider.js.map +1 -1
- package/dist/__tests__/GetEvents.test.d.ts +2 -0
- package/dist/__tests__/GetEvents.test.d.ts.map +1 -0
- package/dist/__tests__/GetEvents.test.js +230 -0
- package/dist/__tests__/GetEvents.test.js.map +1 -0
- package/dist/__tests__/MSGraphProvider.test.js +211 -38
- package/dist/__tests__/MSGraphProvider.test.js.map +1 -1
- package/dist/__tests__/graph-mocks.d.ts +63 -0
- package/dist/__tests__/graph-mocks.d.ts.map +1 -0
- package/dist/__tests__/graph-mocks.js +103 -0
- package/dist/__tests__/graph-mocks.js.map +1 -0
- package/package.json +9 -9
- package/readme.md +41 -1
package/readme.md
CHANGED
|
@@ -60,11 +60,17 @@ AZURE_ACCOUNT_EMAIL=mailbox@yourdomain.com
|
|
|
60
60
|
| `Mail.Send` | SendSingleMessage, ForwardMessage, ReplyToMessage |
|
|
61
61
|
| `Mail.Read` | GetMessages, GetSingleMessage, SearchMessages, ListFolders, ListAttachments, DownloadAttachment |
|
|
62
62
|
| `Mail.ReadWrite` | CreateDraft, DeleteMessage, MoveMessage, MarkAsRead, ArchiveMessage |
|
|
63
|
+
| `Calendars.Read` | GetEvents |
|
|
63
64
|
| `User.Read.All` | GetServiceAccount (user lookup, optional) |
|
|
64
65
|
|
|
66
|
+
`Calendars.Read` is sufficient for `GetEvents`; `Calendars.ReadWrite` is not required, since nothing
|
|
67
|
+
here creates or modifies an event. As **Application** permissions these are granted against the
|
|
68
|
+
tenant, not against one mailbox — narrowing an app to specific mailboxes is done in Exchange with
|
|
69
|
+
RBAC for Applications, not by these grants.
|
|
70
|
+
|
|
65
71
|
## Supported Operations
|
|
66
72
|
|
|
67
|
-
This provider supports all
|
|
73
|
+
This provider supports all 15 operations defined in `BaseCommunicationProvider`:
|
|
68
74
|
|
|
69
75
|
| Operation | Description |
|
|
70
76
|
|-----------|-------------|
|
|
@@ -82,6 +88,7 @@ This provider supports all 14 operations defined in `BaseCommunicationProvider`:
|
|
|
82
88
|
| `SearchMessages` | Full-text search with KQL syntax and date filtering |
|
|
83
89
|
| `ListAttachments` | List attachments on a message |
|
|
84
90
|
| `DownloadAttachment` | Download attachment content as base64/Buffer |
|
|
91
|
+
| `GetEvents` | Read calendar events for one mailbox |
|
|
85
92
|
|
|
86
93
|
## Usage
|
|
87
94
|
|
|
@@ -151,6 +158,39 @@ result.Messages.forEach(msg => {
|
|
|
151
158
|
});
|
|
152
159
|
```
|
|
153
160
|
|
|
161
|
+
### Reading Calendar Events
|
|
162
|
+
|
|
163
|
+
Requires `Calendars.Read`. **Whether you pass a window changes what comes back**, so `GetEvents`
|
|
164
|
+
reports which it did via `RecurrenceExpanded` rather than leaving you to guess:
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
const provider = engine.GetProvider('Microsoft Graph');
|
|
168
|
+
|
|
169
|
+
// With a window -> /calendarView: a recurring series is EXPANDED into one entry per occurrence.
|
|
170
|
+
const occurrences = await provider.GetEvents({
|
|
171
|
+
Identifier: 'rep@example.com',
|
|
172
|
+
NumEvents: 50,
|
|
173
|
+
StartDateTime: new Date('2026-09-01T00:00:00Z'),
|
|
174
|
+
EndDateTime: new Date('2026-09-08T00:00:00Z')
|
|
175
|
+
});
|
|
176
|
+
console.log(occurrences.RecurrenceExpanded); // true
|
|
177
|
+
|
|
178
|
+
// Without one -> /events: a weekly stand-up is ONE row, the series master, whose start time is
|
|
179
|
+
// whenever the series began — possibly years ago.
|
|
180
|
+
const masters = await provider.GetEvents({ Identifier: 'rep@example.com', NumEvents: 50 });
|
|
181
|
+
console.log(masters.RecurrenceExpanded); // false
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Three things worth knowing before syncing on this:
|
|
185
|
+
|
|
186
|
+
- **The window selects overlap, not start times.** An event that began before `StartDateTime` and is
|
|
187
|
+
still running when the window opens is returned. An event straddling a boundary therefore appears
|
|
188
|
+
in both adjacent windows — dedupe on the event id.
|
|
189
|
+
- **`NumEvents` is one page.** It becomes `$top`; there is no `@odata.nextLink` following. To cover a
|
|
190
|
+
period completely, narrow the window rather than raise the number.
|
|
191
|
+
- **Cancelled events are excluded by default** and cannot be recovered after the fact — Graph does not
|
|
192
|
+
return them once filtered. Pass `IncludeCancelled: true` if you are logging history.
|
|
193
|
+
|
|
154
194
|
### Searching Messages
|
|
155
195
|
|
|
156
196
|
MS Graph supports KQL (Keyword Query Language) for search:
|