OiO.lk Blog PHP How to get files on root folder drive PHP MS Graph SDK
PHP

How to get files on root folder drive PHP MS Graph SDK


It can be easy question but the documentation is not clear or has a bug.
When you want to get files from known folder, this is the way:

GET /drives/{drive-id}/items/{item-id}/children

<?php
use Microsoft\Graph\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->drives()->byDriveId('drive-id')->items()->byDriveItemId('driveItem-id')->children()->get()->wait();

you have a DriveId and DriveItemdId, and then you ask files…
But if you want the files from root folder of drive, the url is the following:

GET /me/drive/root/children

But, Could you tell me how it is with PHP SDK? Because the documentation show the other, how if you known the folder Id.
This is url of documentation:
https://learn.microsoft.com/en-us/graph/api/driveitem-list-children?view=graph-rest-1.0&tabs=php

Thank you



You need to sign in to view this answers

Exit mobile version