I am unable to hit HTTP request API for "https://graph.microsoft.com/v1.0/me/users",
"https://graph.microsoft.com/v1.0/me/onenote/notebooks",
"https://graph.microsoft.com/v1.0/me/onenote/pages"
I am successfully connected to Microsoft account and I am getting a valid access token.
**NOTE:** I am using the MSAL library and trying to make HTTP callout from JavaScript.
function callMSGraph(theUrl, accessToken, callback) {
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200)
callback(JSON.parse(this.responseText));
}
xmlHttp.open("GET", theUrl, true); // true for asynchronous
xmlHttp.setRequestHeader('Authorization', 'Bearer ' + accessToken);
xmlHttp.send();
console.log('>>>access token :' + accessToken);
var URL = https://graph.microsoft.com/v1.0/me/users;
testOneNote(URL, accessToken);
}
function testOneNote(theUrl, accessToken) {
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
//callback(JSON.parse(this.responseText));
console.log('>>>Inside api function',JSON.parse(this.responseText));
}
}
xmlHttp.open("GET", theUrl, true); // true for asynchronous
xmlHttp.setRequestHeader('Authorization', 'Bearer ' + accessToken);
xmlHttp.send();
}
"error":
"code": "Request_ResourceNotFound",
"message": "Resource 'users' does not exist or one of its queried
reference-property objects are not present.",
Moved from: