Many of the Microsoft Graph SDKs use the v1.0 Microsoft Graph endpoint by default. The SDKs can be used with the beta endpoint for non-production applications. The method for accessing the beta endpoint depends on which SDK you are using.
Important
APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
In order to call the beta API, you must install the Microsoft.Graph.Beta package. Usage is the same as the Microsoft.Graph package.
// Version 5.x
using Microsoft.Graph.Beta;
// Version 4.x and earlier
// using Microsoft.Graph;
// Create a new instance of GraphServiceClient.
GraphServiceClient graphClient = new GraphServiceClient(...);
The Microsoft Graph SDK for ObjC requires you to build a URL string to the API you want to call. It provides a constant MSGraphBaseURL for the v1.0 endpoint. To use beta, you simply replace that with https://graph.microsoft.com/beta.
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.
The Microsoft Graph SDK for PHP supports the beta endpoint and models. You set the beta endpoint with the setApiVersion method. 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() ";
}
}
Important
The Microsoft Graph SDK for Go is currently in preview. Use of this SDK in production is not supported.