onedrive-api-docs: GET file content not working - daemon version
Hi,
Probably related to this issue.
(1) GET for item meta data works (sort of). The below functions works properly, but does not appear to be documented. The documentation here suggests GET /drive/items/{item-id}, below I am using GET groups/{group-id}/drive/items/{item-id} which works fine.
case ('getItemMetaData'): {
const method = 'GET';
const url = 'https://graph.microsoft.com/v1.0/'
+ 'groups/'
+ msGraphInformation.groupId
+ '/drive/items/'
+ msGraphInformation.itemId;
const headers = {
'Authorization': `Bearer ${msGraphInformation.token}`,
};
return await HTTP.call(method, url, { headers });
}
(1a) Note: Using the documentation code GET /drive/items/{item-id} causes an error shown below, which makes sense as this is obviously a group onedrive.
Exception while invoking method 'msGraph.utils' Error: failed [404] {
I20170301-11:17:42.982(11)? "error": {
I20170301-11:17:42.982(11)? "code": "itemNotFound",
I20170301-11:17:42.982(11)? "message": "The resource could not be found.",
I20170301-11:17:42.982(11)? "innerError": {
I20170301-11:17:42.982(11)? "request-id": "4653e05b-da7c-42df-9282-32733e2aa81b",
I20170301-11:17:42.982(11)? "date": "2017-03-01T00:17:41"
I20170301-11:17:42.983(11)? }
I20170301-11:17:42.983(11)? }
I20170301-11:17:42.983(11)? }
(2) Using the modified code GET groups/{group-id}/drive/items/{item-id}, getting the metadata is fine.
(3) Attempting the same thing but for the download does not work, and throws a 403 Forbidden Error. Code below, note I am passing the group id even though the documentation does not ask for it. Can you please confirm if this is a permissions issue? I’ve tried giving the app most of the permissions, but no luck. Also, getting the meta-data is working so…
case ('getItem'): {
const method = 'GET';
const url = 'https://graph.microsoft.com/v1.0/'
+ 'groups/'
+ msGraphInformation.groupId
+ '/drive/items/'
+ msGraphInformation.itemId
+ '/content';
const headers = {
'Authorization': `Bearer ${msGraphInformation.token}`,
};
return await HTTP.call(method, url, { headers });
}
(4) SImply accessing the data from the URL using the property ‘@microsoft.graph.downloadUrl’ from the meta data get is not working either. This is also throwing a 403: Forbidden Error. That being said, the download path seems fine. However, I cannot reach it from the browser.
Looking at the access token the permissions are below, am I missing something?

Download link also looks ok as far as I can tell.
(5) I also tried to remove the authorisation header for the download, but no luck. Download code below.
case ('downloadItem'): {
const method = 'GET';
const url = msGraphInformation.downloadUrl;
const headers = {
'Authorization': `Bearer ${msGraphInformation.token}`,
};
return await HTTP.call(method, url, { headers });
}
(6) The files are very much present, but I’m looking at this with an admin account so not sure this is useful.

Could you guys please have a look when you get a chance. I think it is pretty similar to the other Get contents issue from last December. Also, a fix to the documentation to include the groups use case would be very much appreciated (or a recommended way to download the contents). Thanks so much.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 24 (8 by maintainers)
Hi tathagatbanerjee, I am assuming you are using an app-only token. If so, there is a known issue with downloading the content of files using this token. You can however, fetch the metadata as you already pointed out. We are working to fix this issue. Stay tuned.