
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
com.microsoft.graph:microsoft-graph
Advanced tools
Get started with the Microsoft Graph SDK for Java by integrating the Microsoft Graph API into your Java application!
Note: this SDK allows you to build applications using the v1.0 of Microsoft Graph. If you want to try the latest Microsoft Graph APIs under beta, use our beta SDK instead.
Add the repository and a compile dependency for microsoft-graph to your project's build.gradle:
repositories {
mavenCentral()
}
dependencies {
// Include the sdk as a dependency
// x-release-please-start-version
implementation 'com.microsoft.graph:microsoft-graph:6.55.0'
// x-release-please-end
// This dependency is only needed if you are using a TokenCredential object for authentication
implementation 'com.azure:azure-identity:1.15.0'
}
Add the dependency in dependencies in pom.xml
<dependency>
<!-- Include the sdk as a dependency -->
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph</artifactId>
<!--x-release-please-start-version-->
<version>6.55.0</version>
<!--x-release-please-end-->
</dependency>
<dependency>
<!-- This dependency is only needed if you are using a TokenCredential object for authentication -->
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.11.0</version>
</dependency>
The nature of the Graph API is such that the SDK needs quite a large set of classes to describe its functionality. You need to ensure that ProGuard is enabled on your project. Otherwise, you will incur long build times for functionality that is not necessarily relevant to your particular application. If you are still hitting the 64K method limit, you can also enable multidexing. Checkout the recommended rules.
Register your application by following the steps at Register your app with the Microsoft Identity Platform.
An instance of the GraphServiceClient class handles building requests, sending them to the Microsoft Graph API, and processing the responses. To create a new instance of this class, you need to provide an instance of AuthenticationProvider, which can authenticate requests to Microsoft Graph.
For an example of how to get an authentication provider, see choose a Microsoft Graph authentication provider.
After you have set the correct application ID and URL, you must get a GraphServiceClient object to make requests against the service. The SDK stores the account information for you, but when a user signs in for the first time, it invokes the UI to get the user's account information.
final AzureIdentityAuthenticationProvider authenticationProvider =
new AzureIdentityAuthenticationProvider(credential, null, scopes);
GraphServiceClient graphClient = new GraphServiceClient(authenticationProvider)
//Alternatively
GraphServiceClient graphClient = new GraphServiceClient(credential, scopes);
After you have a GraphServiceClient that is authenticated, you can begin making calls against the service. The requests against the service look like our REST API.
To retrieve the user's information:
User me = graphClient.me().get();
System.out.printf("Hello %s, your ID is %s%n", me.getDisplayName(), me.getId());
For more detailed documentation, see:
For known issues, see issues.
The Microsoft Graph SDK is open for contribution. To contribute to this project, see Contributing.
The Microsoft Graph SDK for Java library is supported at runtime for Java 8+ and Android API revision 26 and greater.
Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT license.
FAQs
Microsoft Graph SDK
We found that com.microsoft.graph:microsoft-graph demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.