Microsoft Exchange integration via Apex class#
Besides custom API endpoints, Revenue Grid can integrate with Microsoft Exchange through dedicated Apex class methods.
Microsoft Exchange calendar actions performed using Apex class methods#
The Apex integration methods support the following operations:
Retrieve calendar availability from Microsoft Exchange calendars
Create calendar appointments in Microsoft Exchange
Delete calendar appointments from Microsoft Exchange
Retrieve attendees’ unavailable time slots
Reserve selected meeting time slots
Verify synchronization results and return troubleshooting error codes
Note
All date and time values in requests and responses use the ISO 8601 format:
YYYY-MM-DDThh:mm:ssZ
All dates and times are processed in the GMT time zone.
Apex class methods#
Method getTimeSlotsFromOutlook#
Retrieves attendees’ availability data from Microsoft Exchange calendars.
Parameters#
Parameter |
Type |
Description |
|---|---|---|
|
Datetime |
Start date and time of the availability range |
|
Datetime |
End date and time of the availability range |
|
List of strings |
List of attendee email addresses in the same Microsoft Exchange organization |
|
String |
Access token generated by Context Sync |
|
String |
Revenue Grid tenant URL |
Example implementation#
global static void getTimeSlotsFromOutlook(
Datetime startDateTime,
Datetime endDateTime,
List<String> emailsToCheckAvailability,
String accessToken,
String tenant
) {
HttpResponse resp = request(
getUrl(startDateTime, endDateTime, tenant),
'POST',
getAuthHeader(accessToken),
getBodyAvailability(emailsToCheckAvailability),
'getTimeSlots',
null,
'SM001_getTimeSlotsMock'
);
System.debug('resp.getBody(): ' + resp.getBody());
}
Method createOutlookEvent#
Creates calendar appointments in Microsoft Exchange.
Parameters#
Parameter |
Type |
Description |
|---|---|---|
|
Event |
Event object containing appointment properties |
|
String |
Access token generated by Context Sync |
|
String |
Revenue Grid tenant URL |
Example implementation#
global static void createOutlookEvent(
Event eventToCreate,
String accessToken,
String tenant
) {
try {
HttpResponse resp = request(
getUrlMeeting(tenant),
'POST',
getAuthHeader(accessToken),
getBody(eventToCreate, 'CREATE'),
'meeting',
null,
'SM001_getTimeSlotsMock'
);
} catch (Exception e) {
System.debug('Error: ' + e.getMessage() + ' ' + e.getStackTraceString());
}
}
Method deleteOutlookEvent#
Deletes calendar appointments from Microsoft Exchange.
Parameters#
Parameter |
Type |
Description |
|---|---|---|
|
Event |
Event object containing appointment properties |
|
String |
Access token generated by Context Sync |
|
String |
Revenue Grid tenant URL |
Example implementation#
global static void deleteOutlookEvent(
Event eventToDelete,
String accessToken,
String tenant
) {
try {
HttpResponse resp = request(
getUrlMeeting(tenant),
'DELETE',
getAuthHeader(accessToken),
getBody(eventToDelete, 'DELETE'),
'meeting',
null,
'SM001_getTimeSlotsMock'
);
} catch (Exception e) {
System.debug('Error: ' + e.getMessage() + ' ' + e.getStackTraceString());
}
}
Appointment properties in JSON format#
The following JSON payload structures are used by Apex integration methods when creating or deleting Microsoft Exchange appointments.
Create appointment#
The following request body structure is used to create a calendar appointment in Microsoft Exchange.
Request body#
Property |
Type |
Description |
|---|---|---|
|
string |
Unique identifier of the appointment |
|
string |
Email address of the event organizer |
|
string |
Appointment description |
|
string |
Appointment subject |
|
string |
Appointment location |
|
string (ISO 8601 UTC timestamp) |
Appointment start date and time in ISO 8601 format |
|
string (ISO 8601 UTC timestamp) |
Appointment end date and time in ISO 8601 format |
|
string |
Technical identifier generated by Salesforce for troubleshooting and request tracing |
|
array of objects |
List of appointment attendees |
attendees object#
Property |
Type |
Description |
|---|---|---|
|
string |
Email address of the attendee |
|
boolean |
Indicates whether the attendee is required or optional |
Sample request#
{
"id": "18p09032002jmvP11",
"organizerEmail": "[email protected]",
"body": "Agenda: 1, 2, 3",
"subject": "Project Progress Update 2",
"location": "Meeting Room 1",
"startTime": "2022-02-04T01:00:00.000Z",
"endTime": "2022-02-04T02:00:00.000Z",
"salesforceCorrelationId": "16bf7d3b-2055-4f70-bnfd-b0061a38ad1f",
"attendees": [
{
"email": "[email protected]",
"isRequired": "true"
}
]
}
Delete item#
The following request body structure is used to delete a calendar item from Microsoft Exchange.
Request body#
Property |
Type |
Description |
|---|---|---|
|
string |
Unique identifier of the appointment |
|
string |
Email address of the event organizer |
|
array of strings |
List of attendee email addresses |
Sample request#
{
"id": "08p09103202jmvP11",
"organizerEmail": "[email protected]",
"attendees": [
"[email protected]"
]
}
Exchange Server