Skip to content

microsoftgraph/msgraph-snippets-java

Repository files navigation

Microsoft Graph Java SDK Snippets

Java CI with Gradle License.

This repository contains sample snippets for the Microsoft Graph Java SDK. These snippets are referenced in the Microsoft Graph SDK documentation.

Prerequisites

Register an app in Azure Active Directory

  1. Open a browser and navigate to the Microsoft Entra admin center and login using a Work or School Account.

  2. Expand Azure Active Directory in the left-hand navigation, then expand Applications, then select App registrations.

  3. Select New registration. Enter a name for your application, for example, Graph Snippets.

  4. Set Supported account types as desired. The options are:

    Option Who can sign in?
    Accounts in this organizational directory only Only users in your Microsoft 365 organization
    Accounts in any organizational directory Users in any Microsoft 365 organization (work or school accounts)
    Accounts in any organizational directory ... and personal Microsoft accounts Users in any Microsoft 365 organization (work or school accounts) and personal Microsoft accounts
  5. Leave Redirect URI empty.

  6. Select Register. On the application's Overview page, copy the value of the Application (client) ID and save it, you will need it in the next step. If you chose Accounts in this organizational directory only for Supported account types, also copy the Directory (tenant) ID and save it.

  7. Select Authentication under Manage. Locate the Advanced settings section and change the Allow public client flows toggle to Yes, then choose Save.

Configuring the sample

You can set these values directly in app.properties, or you can create a copy of app.properties named app.dev.properties and set the values there.

  1. Set app.clientId to the Application (client) ID from your app registration.
  2. If you chose Accounts in this organizational directory only for Supported account types, set app.tenantId to your Directory (tenant) ID.

Code of conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

About

About Repository of snippets in Microsoft Graph Java SDK documentation.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages