Created
December 12, 2023 14:51
-
-
Save maisarissi/b11ffd8fbb39017e9a924cabba10db5c to your computer and use it in GitHub Desktop.
microsoftgraph-java-v6-v1-beta-clients
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DeviceCodeCredential deviceCodeCredential = new DeviceCodeCredentialBuilder() | |
.clientId(clientId) | |
.tenantId(tenantId) | |
.challengeConsumer(challenge -> System.out.println(challenge.getMessage())) | |
.build(); | |
//create a client for calling v1.0 endpoint | |
com.microsoft.graph.serviceclient.GraphServiceClient graphClient = | |
new com.microsoft.graph.serviceclient.GraphServiceClient( | |
deviceCodeCredential, | |
graphUserScopes); | |
com.microsoft.graph.models.User me = graphClient.me().get(); | |
//create a client for calling beta endpoint | |
com.microsoft.graph.beta.serviceclient.GraphServiceClient betaGraphClient = | |
new com.microsoft.graph.beta.serviceclient.GraphServiceClient( | |
deviceCodeCredential, | |
graphUserScopes); | |
com.microsoft.graph.beta.models.User meBeta = betaGraphClient.me().get(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment