title | description | ms.localizationpriority | author |
---|---|---|---|
Use the Microsoft Graph SDKs with the beta API |
Describes how to use the Microsoft Graph SDKs with the beta version of the API. |
medium |
jasonjoh |
Many Microsoft Graph SDKs use the v1.0 Microsoft Graph endpoint by default. The SDKs can be used with the beta endpoint for nonproduction applications. The method for accessing the beta endpoint depends on your SDK.
[!INCLUDE beta-disclaimer]
To call the 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(...);
To call the API, you must install the Microsoft Graph Beta SDK for Go package.
import (
graphbeta "github.com/microsoftgraph/msgraph-beta-sdk-go"
)
client := graphbeta.NewGraphServiceClientWithCredentials(credentials, scopes)
To call the API, you must install the Microsoft Graph Beta Java SDK. Usage is the same as the nonbeta SDK.
GraphServiceClient graphClient = new GraphServiceClient(tokenCredential, scopes);
The Microsoft Graph Beta SDK for PHP supports the beta endpoint and models. Use the SDK for the beta endpoint in the same way as the SDK for the v1 endpoint.
To use the Microsoft Graph Beta SDK for Python, install the SDK for the beta endpoint with the following command:
pip install msgraph-beta-sdk
Use the SDK for the beta endpoint in the same way as the SDK for the v1 endpoint.
The Microsoft Graph JavaScript Client Library can call the beta API in one of two ways.
-
You can set the version on the
MicrosoftGraph.Client
when you create it. All requests made by the client go to the specified version.const clientOptions: ClientOptions = { defaultVersion: 'beta', ... }; // Initialize Graph client const client = MicrosoftGraph.Client.initWithMiddleware(clientOptions);
-
You can set the version on a specific request by using the
version
function on theGraphRequest
object.const user = await client .api('/me') .version('beta') .get();