Having trouble implementing Microsoft Graph Java SDK to list licenses assigned to user

78 Views Asked by At

I'm currently working on integrating Microsoft Graph APIs into my Java application to retrieve license details for users in my Microsoft 365 tenant. I referred to the official Microsoft documentation here to understand the usage of the Microsoft Graph Java SDK for this purpose. However, despite following the provided guidance, I'm encountering difficulties in implementing the solution within my Java codebase.

Context:

  • I'm utilizing the Microsoft Graph Java SDK to interact with Microsoft 365 APIs.
  • Specifically, I'm referring to the documentation for listing license details for a user here.
  • My authentication setup and GraphServiceClient instantiation are already in place, following the documentation.

Issue: The code snippet provided in the documentation is as follows:


// Code snippets are only available for the latest version. Current version is 6.x

GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);

LicenseDetailsCollectionResponse result = graphClient.users().byUserId("{user-id}").licenseDetails().get();

I've attempted to integrate this code into my Java application. While I can successfully query the Microsoft Graph API using tools like Postman, I'm unable to replicate the functionality within my Java codebase.

Expectation: I'm seeking assistance in understanding and resolving the following:

  1. How can I properly configure the requestAdapter required for initializing the GraphServiceClient instance in Java?

  2. Are there any additional configurations or dependencies required to make the Microsoft Graph Java SDK work seamlessly within a Java application?

I appreciate any insights or guidance on how to resolve this issue and successfully retrieve license details for users using the Microsoft Graph Java SDK within my Java application.

0

There are 0 best solutions below