I am trying to list the children of a folder which is shared with the current user. Using MS Graph explorer, I execute
GET .0/me/drive
to receive the user's driveID.
I then query for the shared folders using
.0/shares/u!aHR0cHxxxGRlcg/items/
where u!aHR0cHxxxGRlcg
is my drive id (with most parts of it in the middle ommitted).
This returns several values, one contains something like
"remoteItem": {
"id": "01RYG63WYxxxxxxxxx5HLRMA7G7BN2AQ6",
"webUrl": ";,
"parentReference": {
"driveType": "business",
"driveId": "b!F93HXdcgMkOPo-Tnp3sYZMyXxxxxxxxxxxxxxxxxxxxxxxxxw_VOSJtJYuuhfcGT",
"id": "01RYG63W56YxxxxxxxZO354PWSELRRZ",
"siteId": "5dc7dd17-20d7-xxxx-8fa3-e4e7a77b1864"
},
Using remoteItem.id
and remoteItem.parentReference.driveId
, I query for children with
GET .0/drives/b!F93HXdcgMkOPo-Tnp3sYZMyXxxxxxxxxxxxxxxxxxxxxxxxxw_VOSJtJYuuhfcGT/items/01RYG63WYxxxxxxxxx5HLRMA7G7BN2AQ6/children
While this is working fine for a personal account, I get
{
"error": {
"code": "invalidRequest",
"message": "ObjectHandle is Invalid",
"innerError": {
"code": "invalidResourceId",
...
}
with a business account. I need a solution which works for both. How can I list the children better?