Skip to content

Instantly share code, notes, and snippets.

@craftfortress
Created November 6, 2017 17:21
Show Gist options
  • Save craftfortress/e8f38b65d489d3ab9f66ebf0e806024e to your computer and use it in GitHub Desktop.
Save craftfortress/e8f38b65d489d3ab9f66ebf0e806024e to your computer and use it in GitHub Desktop.
Basic Example of how to rectify Microsoft Office 360 node outlook API breaking changes from 01/10/2017
var outlook = require('outlook-updated');
var queryParams = {
'$select': 'Subject,ReceivedDateTime ',
'$orderby': 'ReceivedDateTime desc',
'$top': 1
};
outlook.base.setApiEndpoint('https://outlook.office.com/api/v2.0');
outlook.base.setAnchorMailbox(email);
outlook.mail.getMessages({
token: token,
folderId: 'inbox',
odataParams: queryParams
},
function(error, result) { }));
///////////////////////////////
// Has been changed to this: //
///////////////////////////////
var microsoftGraph = require("@microsoft/microsoft-graph-client");
var client = microsoftGraph.Client.init(...
client
.api('/me/mailfolders/inbox/messages')
.header('X-AnchorMailbox', email)
.top(1)
.select('subject,from')
.filter("isRead eq false")
.orderby('receivedDateTime DESC')
.get((err, result) => { });
// You will have to update most of your functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment