Skip to content

Commit fe3e6cc

Browse files
committed
Added READMEs
1 parent d163415 commit fe3e6cc

5 files changed

Lines changed: 93 additions & 3 deletions

File tree

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 Microsoft Graph
3+
Copyright (c) 2019 Microsoft
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,27 @@
1-
# msgraph-training-java
2-
Microsoft Graph Training Module - Build Java apps with Microsoft Graph
1+
# Microsoft Graph Training Module - Build Java apps with the Microsoft Graph Java SDK
2+
3+
This module will introduce you to working with the Microsoft Graph SDK to access data in Office 365 by building Java applications.
4+
5+
## Lab - Build Java apps with the Microsoft Graph Java SDK
6+
7+
In this lab you will create a UWP application using the Azure AD v2 authentication endpoint and the Microsoft Authentication Library (MSAL) to access data in Office 365 using the Microsoft Graph.
8+
9+
- [Java Microsoft Graph tutorial](https://docs.microsoft.com/graph/tutorials/java)
10+
11+
## Demos
12+
13+
The [demos](./demos) directory in this repository contains copies of the project that correspond to completing individual sections of the tutorial. If you just want to demo a particular section of the tutorial, you can start with the version from the previous section.
14+
15+
- [01-create-app](Demos/01-create-app): Completed [Create a Java console app](https://docs.microsoft.com/graph/tutorials/java?tutorial-step=1)
16+
- [02-add-aad-auth](Demos/02-add-aad-auth): Completed [Add Azure AD authentication](https://docs.microsoft.com/graph/tutorials/java?tutorial-step=3)
17+
- [03-add-msgraph](Demos/03-add-msgraph): Completed [Get calendar data](https://docs.microsoft.com/graph/tutorials/java?tutorial-step=4)
18+
19+
## Completed sample
20+
21+
If you just want the completed sample generated by following this lab, you can find it here.
22+
23+
- [Completed project](Demos/03-add-msgraph)
24+
25+
## Disclaimer
26+
27+
**THIS CODE IS PROVIDED _AS IS_ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**

demos/01-create-app/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Completed module: Create a Java console app
2+
3+
The version of the project in this directory reflects completing the tutorial up through [Create an ASP.NET MVC web app](https://docs.microsoft.com/graph/tutorials/java?tutorial-step=1). If you use this version of the project, you need to complete the rest of the tutorial starting at [Register the app in the portal](https://docs.microsoft.com/graph/tutorials/java?tutorial-step=2).

demos/02-add-aad-auth/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Completed module: Add Azure AD authentication
2+
3+
The version of the project in this directory reflects completing the tutorial up through [Add Azure AD authentication](https://docs.microsoft.com/graph/tutorials/java?tutorial-step=3). If you use this version of the project, you need to complete the rest of the tutorial starting at [Get calendar data](https://docs.microsoft.com/graph/tutorials/java?tutorial-step=4).
4+
5+
> **Note:** It is assumed that you have already registered an application in the app registration portal as specified in [Register the app in the portal](https://docs.microsoft.com/graph/tutorials/java?tutorial-step=2). You need to configure this version of the sample as follows:
6+
>
7+
> 1. Rename the `oAuth.properties.example` file to `oAuth.properties`.
8+
> 1. Edit the `oAuth.properties` file and make the following changes.
9+
> 1. Replace `YOUR_APP_ID_HERE` with the **Application Id** you got from the App Registration Portal.

demos/03-add-msgraph/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# How to run the completed project
2+
3+
## Prerequisites
4+
5+
To run the completed project in this folder, you need the following:
6+
7+
- [Java SE Development Kit (JDK)](https://java.com/en/download/faq/develop.xml) and [Maven](https://maven.apache.org/) installed on your development machine. If you do not have the JDK or Maven, visit the previous links for download options. (**Note:** This tutorial was written with OpenJDK version 12.0.1 and Maven 3.6.1. The steps in this guide may work with other versions, but that has not been tested.)
8+
- A Microsoft work or school account.
9+
10+
If you don't have a Microsoft account, you can [sign up for the Office 365 Developer Program](https://developer.microsoft.com/office/dev-program) to get a free Office 365 subscription.
11+
12+
## Register a web application with the Azure Active Directory admin center
13+
14+
1. Open a browser and navigate to the [Azure Active Directory admin center](https://aad.portal.azure.com). Login using a **personal account** (aka: Microsoft Account) or **Work or School Account**.
15+
16+
1. Select **Azure Active Directory** in the left-hand navigation, then select **App registrations** under **Manage**.
17+
18+
![A screenshot of the App registrations ](/tutorial/images/aad-portal-app-registrations.png)
19+
20+
1. Select **New registration**. On the **Register an application** page, set the values as follows.
21+
22+
- Set **Name** to `Java Graph Tutorial`.
23+
- Set **Supported account types** to **Accounts in any organizational directory**.
24+
- Leave **Redirect URI** empty.
25+
26+
![A screenshot of the Register an application page](/tutorial/images/aad-register-an-app.png)
27+
28+
1. Choose **Register**. On the **Java Graph Tutorial** page, copy the value of the **Application (client) ID** and save it, you will need it in the next step.
29+
30+
![A screenshot of the application ID of the new app registration](/tutorial/images/aad-application-id.png)
31+
32+
1. Select the **Add a Redirect URI** link. On the **Redirect URIs** page, locate the **Suggested Redirect URIs for public clients (mobile, desktop)** section. Select the `https://login.microsoftonline.com/common/oauth2/nativeclient` URI.
33+
34+
![A screenshot of the Redirect URIs page](/tutorial/images/aad-redirect-uris.png)
35+
36+
1. Locate the **Default client type** section and change the **Treat application as a public client** toggle to **Yes**, then choose **Save**.
37+
38+
![A screenshot of the Default client type section](/tutorial/images/aad-default-client-type.png)
39+
40+
## Configure the sample
41+
42+
1. Rename the `oAuth.properties.example` file to `oAuth.properties`.
43+
1. Edit the `oAuth.properties` file and make the following changes.
44+
1. Replace `YOUR_APP_ID_HERE` with the **Application Id** you got from the App Registration Portal.
45+
46+
## Build and run the sample
47+
48+
In your command-line interface (CLI), navigate to the project directory and run the following commands.
49+
50+
```Shell
51+
mvn package
52+
java -cp target/graphtutorial-1.0-SNAPSHOT.jar com.contoso.App
53+
```

0 commit comments

Comments
 (0)