我尝试使用Microsoft Graph beta API“require”获取数据:{“microsoft/microsoft-graph-beta”:“^2.0.0-RC13”,“microsoft/microsoft-graph-core”:“@RC”} //代码1 ''''
$tokenRequestContext = new ClientCredentialContext(
',//tenantId
'',//clientId
''//clientSecret
);
$scopes = ['https://graph.microsoft.com/.default'];
$authProvider = new PhpLeagueAuthenticationProvider($tokenRequestContext, $scopes);
$requestAdapter = new GraphRequestAdapter($authProvider);
$betaGraphServiceClient = new GraphServiceClient($requestAdapter);
try {
$response = $betaGraphServiceClient->usersById('[userPrincipalName]')->get();
$user = $response->wait();
echo "Hello, I am {$user->getGivenName()}";
} catch (ApiException $ex) {
echo $ex->getMessage();
}
“”“”//代码2
use Microsoft\Graph\Graph;
use Microsoft\Graph\Model;
use Microsoft\Graph\Beta\GraphRequestAdapter;
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Kiota\Abstractions\ApiException;
use Microsoft\Kiota\Authentication\Oauth\ClientCredentialContext;
use Microsoft\Kiota\Authentication\PhpLeagueAuthenticationProvider;
use Microsoft\Graph\Beta\Generated\Teams\Item\Schedule\Shifts\ShiftsRequestBuilderGetRequestConfiguration;
use Microsoft\Graph\Beta\Generated\Teams\Item\Schedule\Shifts\ShiftsRequestBuilderGetQueryParameters;
$tokenRequestContext = new ClientCredentialContext(
'',//tenantId
'',//clientId
''//clientSecret
);
$scopes = ['https://graph.microsoft.com/.default'];
$authProvider = new PhpLeagueAuthenticationProvider($tokenRequestContext, $scopes);
$requestAdapter = new GraphRequestAdapter($authProvider);
$betaGraphServiceClient = new GraphServiceClient($requestAdapter);
$requestConfiguration = new ShiftsRequestBuilderGetRequestConfiguration();
$queryParameters = new ShiftsRequestBuilderGetQueryParameters();
$queryParameters->filter = "startDateTime ge 2023-01-05T06:00:00.000Z and sharedShift/endDateTime le 2023-01-06T06:00:00.000Z";
$requestConfiguration->queryParameters = $queryParameters;
$requestResult = $betaGraphServiceClient->teamsById('teamId')->schedule()->shifts()->get($requestConfiguration);
''''但返回相同的错误结果致命错误:Microsoft\Graph\Beta\Generated\Models\ODataErrors\ODataError::getAdditionalData()的声明:?array必须与Microsoft\Kiota\Abstractions\Serialization\AdditionalDataHolder::getAdditionalData()兼容:Copyright © 2018 - 2019 www.wzbc.com All Rights Reserved.粤ICP备15048888号-1
1条答案
按热度按时间5lhxktic1#
感谢您试用Beta SDK。
此错误已在
2.0.0-RC14
版本中解决。