microsoftgraph / msgraph-sdk-php

Microsoft Graph Library for PHP.
Other
583 stars 144 forks source link

Fatal error: Uncaught Error: Class "Microsoft\Graph\Generated\BaseGraphClient" not found in vendor\microsoft\microsoft-graph\src\GraphServiceClient.php #1544

Closed developer-itsapp2you closed 3 months ago

developer-itsapp2you commented 5 months ago
use Microsoft\Kiota\Authentication\Oauth\ClientCredentialContext;
use Microsoft\Graph\Core\Authentication\GraphPhpLeagueAuthenticationProvider;
use Microsoft\Graph\GraphServiceClient;

$tokenRequestContext = new ClientCredentialContext(
    $ob_config->tenant,
    $ob_config->client_id,
    $ob_config->client_secret
);

$scopes = ['User.Read', 'Mail.ReadWrite'];
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
print_r($tokenRequestContext);
{
    "config": {
        "allow-plugins": {
            "php-http/discovery": false
        }
    },
    "require": {
        "microsoft/microsoft-graph": "^2.11",
        "microsoft/microsoft-graph-core": "^2.1"
    }
}
Ndiritu commented 3 months ago

Hi @developer-itsapp2you Thanks for reaching out.

Depending on your project structure, you could consider setting the include path and importing composer's autoload file e.g.

set_include_path(__DIR__);
require '../vendor/autoload.php';

Please let me know if this works.

Also, we'd recommend taking a dependency on microsoft-graph directly so that you always get the latest compatible version of microsoft-graph-core transitively

microsoft-github-policy-service[bot] commented 3 months ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.