I'm attempting to modify the node.js Quick Start example to produce a list of the user's excel documents, but I'm running into issues.
This query works (returns a non-empty result) in the Graph Explorer:
https://graph.microsoft.com/v1.0/me/drive/root/search(q='.xlsx')?select=name,id,webUrl
I have tried a few ways to reproduce it in graphHelpers.js. This query returns an empty result:
function getExcelDocs(accessToken, callback) {
// Get list of excel docs in the user's onedrive
request
.get("https://graph.microsoft.com/v1.0/me/drive/root/search(q='.xlsx')?select=name,id,webUrl")
.set('Authorization', 'Bearer ' + accessToken)
.end((err, res) => {
// Returns 200 OK and the search result in the body.
callback(err, res);
});
}
If I substitute the search URL with the drive children query, I get back a non-empty set of documents.
.get('https://graph.microsoft.com/v1.0/me/drive/root/children')
Is there a problem with how I'm formatting the query url?
graphHelpers.js
library but it sounds like it may be unable to handle the search query correctly. Do you have a link to the graphHelpers.js project? Its hard to tell without looking at the code itself. – Marc LaFleur