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

searchWithQ() returning "General exception while processing"

Open r3ganbr0wn opened this issue 8 months ago • 0 comments

I am trying to use the search for DriveItems within a SharePoint drive using the searchWithQ() method of this msgraph-sdk-php package.

$filename = "File_1.txt"; $result = $graphServiceClient->drives()->byDriveId('insert-drive-id-here')->items()->byDriveItemId('child-driveitem-id-here')->searchWithQ($filename)->get()->wait();

The library is returning an ApiException with message "General exception while processing". I cannot find any examples of how to search for DriveItems using this searchWithQ() method, and the Microsoft Graph official example looks incomplete:

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

Is there an official working example of the searchWithQ() functionality?

r3ganbr0wn avatar Apr 17 '25 18:04 r3ganbr0wn