Skip to content
This repository was archived by the owner on Mar 13, 2020. It is now read-only.

Commit 05cf858

Browse files
committed
Update README for v2 endpoint
1 parent 94074d9 commit 05cf858

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎README.md‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -430,18 +430,18 @@ This function uses cURL to send the appropriate request to the specified endpoin
430430

431431
We can use this function to call any of Outlook REST APIs. Let's add a new function to the `OutlookService` class to get the user's 10 most recent messages from the inbox.
432432

433-
In order to call our new `makeApiCall` function, we need an access token, the user's email address, a method, a URL, and an optional payload. We already have the access token, and from the [Mail API Reference](https://msdn.microsoft.com/office/office365/APi/mail-rest-operations#GetMessages), we know that the method to get messages is `GET` and that the URL to get messages is `https://outlook.office.com/api/v1.0/me/messages`. Using that information, add a `getMessages` function in `outlook.php`.
433+
In order to call our new `makeApiCall` function, we need an access token, the user's email address, a method, a URL, and an optional payload. We already have the access token, and from the [Mail API Reference](https://msdn.microsoft.com/office/office365/APi/mail-rest-operations#GetMessages), we know that the method to get messages is `GET` and that the URL to get messages is `https://outlook.office.com/api/v2.0/me/messages`. Using that information, add a `getMessages` function in `outlook.php`.
434434

435435
#### New `getMessages` function in `./outlook.php` ####
436436

437-
private static $outlookApiUrl = "https://outlook.office.com/api/v1.0";
437+
private static $outlookApiUrl = "https://outlook.office.com/api/v2.0";
438438

439439
public static function getMessages($access_token, $user_email) {
440440
$getMessagesParameters = array (
441-
// Only return Subject, DateTimeReceived, and From fields
442-
"\$select" => "Subject,DateTimeReceived,From",
443-
// Sort by DateTimeReceived, newest first
444-
"\$orderby" => "DateTimeReceived DESC",
441+
// Only return Subject, ReceivedDateTime, and From fields
442+
"\$select" => "Subject,ReceivedDateTime,From",
443+
// Sort by ReceivedDateTime, newest first
444+
"\$orderby" => "ReceivedDateTime DESC",
445445
// Return at most 10 results
446446
"\$top" => "10"
447447
);
@@ -453,7 +453,7 @@ In order to call our new `makeApiCall` function, we need an access token, the us
453453

454454
The function uses OData query parameters to do the following.
455455

456-
- Request that only the `Subject`, `DateTimeReceived`, and `From` fields for each message be returned. It's always a good idea to limit your result set to only those fields that you will use in your app.
456+
- Request that only the `Subject`, `ReceivedDateTime`, and `From` fields for each message be returned. It's always a good idea to limit your result set to only those fields that you will use in your app.
457457
- Sort the results by date and time each message was received.
458458
- Limit the results to the first 10 items.
459459

@@ -541,7 +541,7 @@ Update `./home.php` one final time to generate the table.
541541
<tr>
542542
<td><?php echo $message['From']['EmailAddress']['Name'] ?></td>
543543
<td><?php echo $message['Subject'] ?></td>
544-
<td><?php echo $message['DateTimeReceived'] ?></td>
544+
<td><?php echo $message['ReceivedDateTime'] ?></td>
545545
</tr>
546546
<?php } ?>
547547
</table>

0 commit comments

Comments
 (0)