Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge to publish #242

Merged
merged 105 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
2f9fe3a
Bump com.microsoft.graph:microsoft-graph
dependabot[bot] Jan 22, 2024
fb3134f
Merge pull request #192 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] Jan 22, 2024
f5516b2
Bump com.google.guava:guava in /app-auth/graphapponlytutorial
dependabot[bot] Jan 22, 2024
7dba35b
Bump com.microsoft.graph:microsoft-graph in /user-auth/graphtutorial
dependabot[bot] Jan 22, 2024
0d1a956
Merge pull request #193 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] Jan 22, 2024
04a8ada
Bump com.google.guava:guava in /user-auth/graphtutorial
dependabot[bot] Jan 22, 2024
909ceb1
Bump com.microsoft.graph:microsoft-graph
dependabot[bot] Jan 29, 2024
ecb9339
Merge pull request #194 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] Jan 29, 2024
10f8725
Bump com.microsoft.graph:microsoft-graph in /user-auth/graphtutorial
dependabot[bot] Jan 29, 2024
8cce872
Merge pull request #195 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] Jan 29, 2024
3c65922
Merge pull request #189 from microsoftgraph/dependabot/gradle/user-au…
dependabot[bot] Jan 30, 2024
5fbf3d0
Merge pull request #188 from microsoftgraph/dependabot/gradle/app-aut…
dependabot[bot] Jan 30, 2024
e942bbd
Updated user-auth to Graph SDK v6 snapshot
jasonjoh Jan 31, 2024
d4e91d8
Updated app-auth to Graph SDK v6 snapshot
jasonjoh Jan 31, 2024
10ba03f
Updated SDK to GA version
jasonjoh Feb 9, 2024
630217e
Merge pull request #196 from microsoftgraph/sdk-v6
jasonjoh Feb 9, 2024
c711d37
Removed sonatype.org snapshots repo
jasonjoh Feb 9, 2024
7db4d9e
Bump com.azure:azure-identity in /app-auth/graphapponlytutorial
dependabot[bot] Feb 12, 2024
111545a
Merge pull request #197 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] Feb 12, 2024
3167bbb
Bump com.azure:azure-identity in /user-auth/graphtutorial
dependabot[bot] Feb 12, 2024
0340706
Merge pull request #198 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] Feb 12, 2024
660116c
Bump com.microsoft.graph:microsoft-graph in /user-auth/graphtutorial
dependabot[bot] Feb 19, 2024
d94d806
Merge pull request #199 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] Feb 19, 2024
f0a855d
Bump com.microsoft.graph:microsoft-graph
dependabot[bot] Feb 19, 2024
5d5372d
Merge pull request #200 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] Feb 19, 2024
61a2dcc
Bump com.microsoft.graph:microsoft-graph in /user-auth/graphtutorial
dependabot[bot] Feb 26, 2024
1833923
Merge pull request #201 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] Feb 26, 2024
c8091f4
Bump com.microsoft.graph:microsoft-graph
dependabot[bot] Feb 26, 2024
561a9c8
Merge pull request #202 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] Feb 26, 2024
ae1a0e1
Bump com.azure:azure-identity in /app-auth/graphapponlytutorial
dependabot[bot] Mar 4, 2024
1d1ba21
Merge pull request #204 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] Mar 4, 2024
36d8b9e
Bump com.microsoft.graph:microsoft-graph
dependabot[bot] Mar 4, 2024
47f9143
Merge pull request #203 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] Mar 4, 2024
c60a58e
Bump com.microsoft.graph:microsoft-graph in /user-auth/graphtutorial
dependabot[bot] Mar 4, 2024
48b3f87
Merge pull request #205 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] Mar 4, 2024
6b2846f
Bump com.google.guava:guava in /user-auth/graphtutorial
dependabot[bot] Mar 18, 2024
0d3c95a
Merge pull request #208 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] Mar 18, 2024
c409fb8
Bump com.azure:azure-identity in /user-auth/graphtutorial
dependabot[bot] Mar 18, 2024
9bd850b
Merge pull request #207 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] Mar 18, 2024
d57f3f4
Bump com.azure:azure-identity in /app-auth/graphapponlytutorial
dependabot[bot] Mar 18, 2024
5fa8e9e
Merge pull request #209 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] Mar 18, 2024
2e3b039
Bump com.google.guava:guava in /app-auth/graphapponlytutorial
dependabot[bot] Mar 18, 2024
3f95515
Merge pull request #210 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] Mar 18, 2024
430d195
Bump com.microsoft.graph:microsoft-graph
dependabot[bot] Apr 1, 2024
273dbe2
Merge pull request #211 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] Apr 1, 2024
a525982
Bump com.microsoft.graph:microsoft-graph in /user-auth/graphtutorial
dependabot[bot] Apr 1, 2024
27a4e23
Merge pull request #212 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] Apr 1, 2024
c7ed8e6
Bump com.azure:azure-identity in /app-auth/graphapponlytutorial
dependabot[bot] Apr 15, 2024
30caebd
Merge pull request #213 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] Apr 15, 2024
222aa44
Bump com.azure:azure-identity in /user-auth/graphtutorial
dependabot[bot] Apr 15, 2024
7a6bcd5
Merge pull request #214 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] Apr 15, 2024
1fee821
Bump com.microsoft.graph:microsoft-graph
dependabot[bot] Apr 22, 2024
6becf61
Bump com.microsoft.graph:microsoft-graph in /user-auth/graphtutorial
dependabot[bot] Apr 22, 2024
aa13e20
Merge pull request #215 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] Apr 22, 2024
2a545da
Merge pull request #216 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] Apr 22, 2024
13c524d
Bump com.microsoft.graph:microsoft-graph in /user-auth/graphtutorial
dependabot[bot] Apr 29, 2024
5e6a4cf
Merge pull request #217 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] Apr 29, 2024
36d15c6
Bump com.microsoft.graph:microsoft-graph
dependabot[bot] Apr 29, 2024
3d5b101
Merge pull request #218 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] Apr 29, 2024
b50f529
Bump com.google.guava:guava in /app-auth/graphapponlytutorial
dependabot[bot] May 6, 2024
4773213
Bump com.microsoft.graph:microsoft-graph
dependabot[bot] May 6, 2024
8783139
Merge pull request #219 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] May 6, 2024
b7c5a86
Merge pull request #221 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] May 6, 2024
cb2ebdd
Bump com.azure:azure-identity in /app-auth/graphapponlytutorial
dependabot[bot] May 6, 2024
276d783
Merge pull request #220 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] May 6, 2024
f1691d7
Bump com.google.guava:guava in /user-auth/graphtutorial
dependabot[bot] May 6, 2024
7ab7118
Bump com.microsoft.graph:microsoft-graph in /user-auth/graphtutorial
dependabot[bot] May 6, 2024
754f169
Merge pull request #223 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] May 6, 2024
a6717c8
Merge pull request #222 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] May 6, 2024
16bd91f
Bump com.azure:azure-identity in /user-auth/graphtutorial
dependabot[bot] May 6, 2024
1b44992
Merge pull request #224 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] May 6, 2024
f5afff5
Bump com.microsoft.graph:microsoft-graph
dependabot[bot] May 13, 2024
082c9c9
Merge pull request #225 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] May 13, 2024
17e3cea
Bump com.microsoft.graph:microsoft-graph in /user-auth/graphtutorial
dependabot[bot] May 13, 2024
582682a
Merge pull request #226 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] May 13, 2024
17c425e
- updates code of conduct to the latest standard
baywet May 17, 2024
81fbf6b
Merge pull request #227 from baywet/main
jasonjoh May 17, 2024
e27e84d
Bump com.microsoft.graph:microsoft-graph in /user-auth/graphtutorial
dependabot[bot] May 20, 2024
bc01efc
Merge pull request #228 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] May 20, 2024
2e2c356
Bump com.microsoft.graph:microsoft-graph
dependabot[bot] May 20, 2024
1d5eb6d
Merge pull request #229 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] May 20, 2024
6de1f3a
Bump com.microsoft.graph:microsoft-graph
dependabot[bot] May 27, 2024
0078379
Merge pull request #230 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] May 27, 2024
8e8a452
Bump com.microsoft.graph:microsoft-graph in /user-auth/graphtutorial
dependabot[bot] May 27, 2024
d6568b9
Merge pull request #231 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] May 27, 2024
7b83045
Bump com.microsoft.graph:microsoft-graph
dependabot[bot] Jun 3, 2024
0e2dca9
Bump com.google.guava:guava in /app-auth/graphapponlytutorial
dependabot[bot] Jun 3, 2024
ab1e24c
Merge pull request #233 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] Jun 3, 2024
8910ab4
Merge pull request #232 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] Jun 3, 2024
7708fd6
Bump com.google.guava:guava in /user-auth/graphtutorial
dependabot[bot] Jun 3, 2024
e51c140
Bump com.microsoft.graph:microsoft-graph in /user-auth/graphtutorial
dependabot[bot] Jun 3, 2024
aa8e321
Merge pull request #234 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] Jun 3, 2024
8f43871
Merge pull request #235 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] Jun 3, 2024
f2e528e
Bump com.microsoft.graph:microsoft-graph
dependabot[bot] Jun 10, 2024
48f4c94
Merge pull request #236 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] Jun 10, 2024
b9d809d
Bump com.microsoft.graph:microsoft-graph in /user-auth/graphtutorial
dependabot[bot] Jun 10, 2024
4598eb7
Merge pull request #237 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] Jun 10, 2024
e865897
Bump com.azure:azure-identity in /user-auth/graphtutorial
dependabot[bot] Jun 17, 2024
7ff284a
Merge pull request #238 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] Jun 17, 2024
de46085
Bump com.azure:azure-identity in /app-auth/graphapponlytutorial
dependabot[bot] Jun 17, 2024
501c448
Merge pull request #239 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] Jun 17, 2024
ed88b4b
Bump com.azure:azure-identity in /user-auth/graphtutorial
dependabot[bot] Jun 24, 2024
70293c1
Merge pull request #240 from microsoftgraph/dependabot/gradle/user-au…
github-actions[bot] Jun 24, 2024
88c94e1
Bump com.azure:azure-identity in /app-auth/graphapponlytutorial
dependabot[bot] Jun 24, 2024
04714e3
Merge pull request #241 from microsoftgraph/dependabot/gradle/app-aut…
github-actions[bot] Jun 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Microsoft Open Source Code of Conduct

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).

Resources:

- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
- Contact [[email protected]](mailto:[email protected]) with questions or concerns
- Employees can reach out at [aka.ms/opensource/moderation-support](https://aka.ms/opensource/moderation-support)
6 changes: 3 additions & 3 deletions app-auth/graphapponlytutorial/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ dependencies {
testImplementation 'junit:junit:4.13.2'

// This dependency is used by the application.
implementation 'com.google.guava:guava:31.1-jre'
implementation 'com.azure:azure-identity:1.11.1'
implementation 'com.microsoft.graph:microsoft-graph:5.77.0'
implementation 'com.google.guava:guava:33.2.1-jre'
implementation 'com.azure:azure-identity:1.13.0'
implementation 'com.microsoft.graph:microsoft-graph:6.13.0'
}
// </DependenciesSnippet>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import java.util.Scanner;

import com.microsoft.graph.models.User;
import com.microsoft.graph.requests.UserCollectionPage;
// </ImportSnippet>
import com.microsoft.graph.models.UserCollectionResponse;

public class App {
// <MainSnippet>
Expand Down Expand Up @@ -102,16 +102,16 @@ private static void displayAccessToken() {
// <ListUsersSnippet>
private static void listUsers() {
try {
final UserCollectionPage users = Graph.getUsers();
final UserCollectionResponse users = Graph.getUsers();

// Output each user's details
for (User user: users.getCurrentPage()) {
System.out.println("User: " + user.displayName);
System.out.println(" ID: " + user.id);
System.out.println(" Email: " + user.mail);
for (User user: users.getValue()) {
System.out.println("User: " + user.getDisplayName());
System.out.println(" ID: " + user.getId());
System.out.println(" Email: " + user.getMail());
}

final Boolean moreUsersAvailable = users.getNextPage() != null;
final Boolean moreUsersAvailable = users.getOdataNextLink() != null;
System.out.println("\nMore users available? " + moreUsersAvailable);
} catch (Exception e) {
System.out.println("Error getting users");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,21 @@
// <ImportSnippet>
package graphapponlytutorial;

import java.util.List;
import java.util.Properties;

import com.azure.core.credential.AccessToken;
import com.azure.core.credential.TokenRequestContext;
import com.azure.identity.ClientSecretCredential;
import com.azure.identity.ClientSecretCredentialBuilder;
import com.microsoft.graph.authentication.TokenCredentialAuthProvider;
import com.microsoft.graph.requests.GraphServiceClient;
import com.microsoft.graph.requests.UserCollectionPage;

import okhttp3.Request;
import com.microsoft.graph.models.UserCollectionResponse;
import com.microsoft.graph.serviceclient.GraphServiceClient;
// </ImportSnippet>

public class Graph {
// <AppOnyAuthConfigSnippet>
private static Properties _properties;
private static ClientSecretCredential _clientSecretCredential;
private static GraphServiceClient<Request> _appClient;
private static GraphServiceClient _appClient;

public static void initializeGraphForAppOnlyAuth(Properties properties) throws Exception {
// Ensure properties isn't null
Expand All @@ -45,14 +41,8 @@ public static void initializeGraphForAppOnlyAuth(Properties properties) throws E
}

if (_appClient == null) {
final TokenCredentialAuthProvider authProvider =
new TokenCredentialAuthProvider(
// Use the .default scope when using app-only auth
List.of("https://graph.microsoft.com/.default"), _clientSecretCredential);

_appClient = GraphServiceClient.builder()
.authenticationProvider(authProvider)
.buildClient();
_appClient = new GraphServiceClient(_clientSecretCredential,
new String[] { "https://graph.microsoft.com/.default" });
}
}
// </AppOnyAuthConfigSnippet>
Expand All @@ -76,18 +66,17 @@ public static String getAppOnlyToken() throws Exception {
// </GetAppOnlyTokenSnippet>

// <GetUsersSnippet>
public static UserCollectionPage getUsers() throws Exception {
public static UserCollectionResponse getUsers() throws Exception {
// Ensure client isn't null
if (_appClient == null) {
throw new Exception("Graph has not been initialized for app-only auth");
}

return _appClient.users()
.buildRequest()
.select("displayName,id,mail")
.top(25)
.orderBy("displayName")
.get();
return _appClient.users().get(requestConfig -> {
requestConfig.queryParameters.select = new String[] { "displayName", "id", "mail" };
requestConfig.queryParameters.top = 25;
requestConfig.queryParameters.orderby = new String[] { "displayName" };
});
}
// </GetUsersSnippet>

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
41 changes: 28 additions & 13 deletions app-auth/graphapponlytutorial/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,11 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,22 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,18 +198,28 @@ if "$cygwin" || "$msys" ; then
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
35 changes: 19 additions & 16 deletions app-auth/graphapponlytutorial/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,13 +41,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
6 changes: 3 additions & 3 deletions user-auth/graphtutorial/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ dependencies {
testImplementation 'junit:junit:4.13.2'

// This dependency is used by the application.
implementation 'com.google.guava:guava:31.1-jre'
implementation 'com.azure:azure-identity:1.11.1'
implementation 'com.microsoft.graph:microsoft-graph:5.77.0'
implementation 'com.google.guava:guava:33.2.1-jre'
implementation 'com.azure:azure-identity:1.13.0'
implementation 'com.microsoft.graph:microsoft-graph:6.13.0'
}
// </DependenciesSnippet>

Expand Down
22 changes: 11 additions & 11 deletions user-auth/graphtutorial/app/src/main/java/graphtutorial/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import java.util.Scanner;

import com.microsoft.graph.models.Message;
import com.microsoft.graph.models.MessageCollectionResponse;
import com.microsoft.graph.models.User;
import com.microsoft.graph.requests.MessageCollectionPage;
// </ImportSnippet>

public class App {
Expand Down Expand Up @@ -105,8 +105,8 @@ private static void greetUser() {
final User user = Graph.getUser();
// For Work/school accounts, email is in mail property
// Personal accounts, email is in userPrincipalName
final String email = user.mail == null ? user.userPrincipalName : user.mail;
System.out.println("Hello, " + user.displayName + "!");
final String email = user.getMail() == null ? user.getUserPrincipalName() : user.getMail();
System.out.println("Hello, " + user.getDisplayName() + "!");
System.out.println("Email: " + email);
} catch (Exception e) {
System.out.println("Error getting user");
Expand All @@ -130,20 +130,20 @@ private static void displayAccessToken() {
// <ListInboxSnippet>
private static void listInbox() {
try {
final MessageCollectionPage messages = Graph.getInbox();
final MessageCollectionResponse messages = Graph.getInbox();

// Output each message's details
for (Message message: messages.getCurrentPage()) {
System.out.println("Message: " + message.subject);
System.out.println(" From: " + message.from.emailAddress.name);
System.out.println(" Status: " + (message.isRead ? "Read" : "Unread"));
System.out.println(" Received: " + message.receivedDateTime
for (Message message: messages.getValue()) {
System.out.println("Message: " + message.getSubject());
System.out.println(" From: " + message.getFrom().getEmailAddress().getName());
System.out.println(" Status: " + (message.getIsRead() ? "Read" : "Unread"));
System.out.println(" Received: " + message.getReceivedDateTime()
// Values are returned in UTC, convert to local time zone
.atZoneSameInstant(ZoneId.systemDefault()).toLocalDateTime()
.format(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT)));
}

final Boolean moreMessagesAvailable = messages.getNextPage() != null;
final Boolean moreMessagesAvailable = messages.getOdataNextLink() != null;
System.out.println("\nMore messages available? " + moreMessagesAvailable);
} catch (Exception e) {
System.out.println("Error getting inbox");
Expand All @@ -158,7 +158,7 @@ private static void sendMail() {
// Send mail to the signed-in user
// Get the user for their email address
final User user = Graph.getUser();
final String email = user.mail == null ? user.userPrincipalName : user.mail;
final String email = user.getMail() == null ? user.getUserPrincipalName() : user.getMail();

Graph.sendMail("Testing Microsoft Graph", "Hello world!", email);
System.out.println("\nMail sent.");
Expand Down
Loading
Loading