Viele Microsoft Graph-SDKs verwenden standardmäßig den v 1.0 Microsoft Graph-Endpunkt.Many of the Microsoft Graph SDKs use the v1.0 Microsoft Graph endpoint by default.Die SDKs können mit dem Beta -Endpunkt für nicht-Produktionsanwendungen verwendet werden.The SDKs can be used with the beta endpoint for non-production applications.Die Methode für den Zugriff auf den Beta-Endpunkt hängt von dem verwendeten SDK ab.The method for accessing the beta endpoint depends on which SDK you are using.
Wichtig
APIs unter der /beta Version in Microsoft Graph können Änderungen unterworfen werden.APIs under the /beta version in Microsoft Graph are subject to change.Die Verwendung dieser APIs in Produktionsanwendungen wird nicht unterstützt.Use of these APIs in production applications is not supported.Um zu ermitteln, ob eine API in v 1.0 verfügbar ist, verwenden Sie die Versions Auswahl.To determine whether an API is available in v1.0, use the Version selector.
Um die Beta-API aufzurufen, müssen Sie das Microsoft. Graph. Beta -Paket installieren.In order to call the beta API, you must install the Microsoft.Graph.Beta package.Die Verwendung ist identisch mit dem Microsoft.Graph Paket.Usage is the same as the Microsoft.Graph package.
using Microsoft.Graph.Beta;
// Create a new instance of GraphServiceClient.
GraphServiceClient graphClient = new GraphServiceClient(...);
Sie können die Version auf der festlegen, MicrosoftGraph.Client Wenn Sie Sie erstellen.You can set the version on the MicrosoftGraph.Client when you create it.Alle vom Client vorgenommenen Anforderungen werden an die angegebene Version weitergegeben.All requests made by the client will go to the specified version.
Sie können die Version für eine bestimmte Anforderung festlegen, indem Sie die version -Funktion für das GraphRequest Objekt verwenden.You can set the version on a specific request by using the version function on the GraphRequest object.
const user = await client
.api('/me')
.version('beta')
.get();
Um die Beta-API aufzurufen, müssen Sie das Microsoft Graph Beta Java SDKinstallieren.In order to call the beta API, you must install the Microsoft Graph Beta Java SDK.Die Verwendung ist identisch mit dem nicht-Beta-SDK.Usage is the same as the non-beta SDK.
Das Microsoft Graph-SDK für ObjC erfordert die Erstellung einer URL-Zeichenfolge für die API, die Sie aufrufen möchten.The Microsoft Graph SDK for ObjC requires you to build a URL string to the API you want to call.Es stellt eine Konstante MSGraphBaseURL für den v 1.0-Endpunkt bereit.It provides a constant MSGraphBaseURL for the v1.0 endpoint.Um Beta zu verwenden, ersetzen Sie einfach diese durch https://graph.microsoft.com/beta .To use beta, you simply replace that with https://graph.microsoft.com/beta.
Die Modelle im SDK für Microsoft Graph-Modelle werden jedoch aus Objekten in der v 1.0-API generiert, sodass Sie nicht mit Beta-Objekten arbeiten können.However, the models in the Microsoft Graph Models SDK are generated from objects in the v1.0 API, so they may not work with beta objects.
Das Microsoft Graph-SDK für php unterstützt den Beta-Endpunkt und die Modelle.The Microsoft Graph SDK for PHP supports the beta endpoint and models.Sie legen den Beta-Endpunkt mit der setApiVersion -Methode fest.You set the beta endpoint with the setApiVersion method.Sie müssen die v 1.0-und Beta-Modelle durch Bereitstellen eines Alias eindeutiger unterscheiden.You will need to disambiguate the v1.0 and beta models by providing an alias.
use Microsoft\Graph\Graph;
use Beta\Microsoft\Graph\Model as BetaModel;
class UseBeta
{
public function run()
{
$accessToken = 'xxx';
$graph = new Graph();
$graph->setAccessToken($accessToken);
$user = $graph->setApiVersion("beta")
->createRequest("GET", "/me")
->setReturnType(BetaModel\User::class)
->execute();
echo "Hello, I am $user->getGivenName() ";
}
}