msgraph-sdk-php icon indicating copy to clipboard operation
msgraph-sdk-php copied to clipboard

How to get a specific drive by name

Open EmilySamantha80 opened this issue 2 years ago • 0 comments

I'm attempting to get a list of drives in v2.0.0 RC9 for a given site so I can figure out what the drive ID is for a given document library in order to list the files that it contains.

The closest I've gotten is getting the drive info for a site that I'm then unable to access:

$requestConfig = new SiteItemRequestBuilderGetRequestConfiguration();
$requestConfig->queryParameters = new SiteItemRequestBuilderGetQueryParameters();
$requestConfig->queryParameters->select = ['name', 'id', 'drives'];
$requestConfig->queryParameters->expand = ['drives'];

$site = $graphServiceClient->sitesById($siteId)->get($requestConfig)->wait();

This will fetch the list of drives that I can see using var_dump, but I don't know how to access them by name without enumerating all the drives first.

EmilySamantha80 avatar Oct 07 '22 20:10 EmilySamantha80