Class GraphClient

java.lang.Object
com.independentsoft.graph.GraphClient

public class GraphClient extends Object
The main client for interacting with the Microsoft Graph API.

GraphClient provides methods to access Microsoft Graph resources including:

  • Users - Manage user accounts and profiles
  • Mail - Send and receive email messages, manage folders
  • Calendar - Access events, schedule meetings, manage calendars
  • Contacts - Manage personal and organizational contacts
  • Files - Access OneDrive files and folders
  • Groups - Manage Microsoft 365 groups
  • Teams - Access Microsoft Teams channels and chats
  • Sites - Interact with SharePoint sites
  • To-Do - Manage tasks and task lists

This client supports multiple OAuth 2.0 authentication flows including: authorization code flow, device code flow, client credentials flow, and username/password flow.

Example usage:

 GraphClient client = new GraphClient();
 client.setClientId("your-client-id");
 client.setTenant("your-tenant-id");
 client.setScope(Arrays.asList("User.Read", "Mail.ReadWrite"));
 client.setAuthorizationCode("authorization-code");
 
 // Get current user
 User user = client.me();
 
 // List messages
 List<Message> messages = client.listMessages();
 
Since:
1.1.1250
See Also:
Use the Microsoft Graph API, Microsoft Graph authentication