Closed Jumbo125 closed 1 month ago
Hi @Jumbo125 , Please try using
use Microsoft\Graph\Generated\Models\AttachmentItem;
Feel free to reopen the issue if that doesn't work.
sorry, but i have another problem to create a graph client. i got "invalid scope" when i tried User.Read.All So i test it with the default option.
here is the code
// single-tenant apps must use the tenant ID from the Azure portal
$tenantId = 'f8cdef3xxxxxxxxxxxx'; //'common';
// Values from app registration
$clientId = '71dcb9xxxxxxxxxxxxxxxxxx';
$clientSecret = 'Gci8Q~8klANAIdcxxxxxxxxxxxxxxx';
$redirectUri = 'http://localhost/test1/src/test2/test.php';
$tokenRequestContext = new ClientCredentialContext(
$tenantId,
$clientId,
$clientSecret
);
// Defaults to using https://graph.microsoft.com/.default scopes
$graphServiceClient = new GraphServiceClient($tokenRequestContext);
// With specific scopes
$scopes = ['User.Read.All']; //'https://graph.microsoft.com/.default
$graphClient = new GraphServiceClient($tokenRequestContext, $scopes);
the error message
Fatal error: Uncaught League\OAuth2\Client\Provider\Exception\IdentityProviderException: invalid_scope in C:\xampp_update\htdocs\test1\src\test2\vendor\league\oauth2-client\src\Provider\GenericProvider.php:236 Stack trace: #0 C:\xampp_update\htdocs\test1\src\test2\vendor\league\oauth2-client\src\Provider\AbstractProvider.php(726): League\OAuth2\Client\Provider\GenericProvider->checkResponse(Object(GuzzleHttp\Psr7\Response), Array) #1 C:\xampp_update\htdocs\test1\src\test2\vendor\league\oauth2-client\src\Provider\AbstractProvider.php(635): League\OAuth2\Client\Provider\AbstractProvider->getParsedResponse(Object(GuzzleHttp\Psr7\Request)) #2 C:\xampp_update\htdocs\test1\src\test2\vendor\microsoft\kiota-authentication-phpleague\src\PhpLeagueAccessTokenProvider.php(303): League\OAuth2\Client\Provider\AbstractProvider->getAccessToken(Object(League\OAuth2\Client\Grant\ClientCredentials), Array) #3 C:\xampp_update\htdocs\test1\src\test2\vendor\microsoft\kiota-authentication-phpleague\src\PhpLeagueAccessTokenProvider.php(169): Microsoft\Kiota\Authentication\PhpLeagueAccessTokenProvider->requestNewToken(Array, Object(OpenTelemetry\API\Trace\NonRecordingSpan)) #4 C:\xampp_update\htdocs\test1\src\test2\vendor\microsoft\kiota-abstractions\src\Authentication\BaseBearerTokenAuthenticationProvider.php(75): Microsoft\Kiota\Authentication\PhpLeagueAccessTokenProvider->getAuthorizationTokenAsync('https://graph.m...', Array) #5 C:\xampp_update\htdocs\test1\src\test2\vendor\microsoft\kiota-http-guzzle\src\GuzzleRequestAdapter.php(541): Microsoft\Kiota\Abstractions\Authentication\BaseBearerTokenAuthenticationProvider->authenticateRequest(Object(Microsoft\Kiota\Abstractions\RequestInformation), Array) #6 C:\xampp_update\htdocs\test1\src\test2\vendor\microsoft\kiota-http-guzzle\src\GuzzleRequestAdapter.php(144): Microsoft\Kiota\Http\GuzzleRequestAdapter->getHttpResponseMessage(Object(Microsoft\Kiota\Abstractions\RequestInformation), '', Object(OpenTelemetry\API\Trace\NonRecordingSpan)) #7 C:\xampp_update\htdocs\test1\src\test2\vendor\microsoft\microsoft-graph\src\Generated\Users\Item\Drive\DriveRequestBuilder.php(44): Microsoft\Kiota\Http\GuzzleRequestAdapter->sendAsync(Object(Microsoft\Kiota\Abstractions\RequestInformation), Array, Array) #8 C:\xampp_update\htdocs\test1\src\test2\test4.php(63): Microsoft\Graph\Generated\Users\Item\Drive\DriveRequestBuilder->get() #9 {main} thrown in C:\xampp_update\htdocs\test1\src\test2\vendor\league\oauth2-client\src\Provider\GenericProvider.php on line 236
does anybody knows which path i need to insert via use?
i can't use the attachmentitem class