Executed the PHP quickstart code for outlook restapi v2.0 for accessing mails with oauth2 authorization.
Complete Code can be viewed here - "https://dev.outlook.com/RestGettingStarted/Tutorial/php" under "outlook.php"
scope: https://outlook.office.com/mail.read
token_type: Bearer
I've received the access_token, expires_in, id_token and id_token_expires_in
and expires_in value is 3600
public static function getMessages($access_token, $user_email) {
$getMessagesParameters = array (
// Only return Subject, ReceivedDateTime, and From fields
"\$select" => "Subject,ReceivedDateTime,From",
// Sort by ReceivedDateTime, newest first
"\$orderby" => "ReceivedDateTime DESC",
// Return at most 10 results
"\$top" => "10"
);
...
Is there any changes need to be done on the "$getMessagesParameters"? I tried removing everything but still it didn't work!(gives a 400 HTTP error)
Is there any recent modifications in the way we access outlook rest api resources?
update: I used a hotmail account to create a application and used the same account for accessing mails from. Is it because mails with hotmail.com is not completely integrated with outlook.com mail services?
Now the Error code changed to "404"
Checked it in Outlook Sandbox and they state that the user inbox should be REST API enabled for it to work.
this is not a duplicate of "Office 365 API - Request returned HTTP error 400"(where the questioner has troubles with contacts and calendars but not mails)