You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: hub/apps/windows-dotnet-maui/tutorial-graph-api.md
+19-3Lines changed: 19 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,9 +11,19 @@ ms.localizationpriority: medium
11
11
12
12
Get hands-on with .NET MAUI by building a cross-platform app on Windows that leverages the [Microsoft Graph SDK](/graph/sdks/sdks-overview) to display user data.
13
13
14
-
## Introduction
14
+
In this tutorial, you learn how to:
15
15
16
-
In this tutorial, you'll learn how to create a .NET MAUI app for Windows in Visual Studio 2022 (17.3 or later) that loads some user data from [Microsoft Graph](/graph/). We will [authenticate](/graph/authenticationmethods-get-started) a Microsoft account with [Azure Identity](/graph/azuread-identity-access-management-concept-overview). The identity information, in the form of an MSAL token, will be used to authorize the Graph SDK call and get the display name for the authenticated user.
16
+
> [!div class="checklist"]
17
+
> * Set up your environment for .NET MAUI development and create a .NET MAUI project
18
+
> * Register your client app in Azure
19
+
> * Integrate with [Azure Identity](/graph/azuread-identity-access-management-concept-overview) and the Microsoft Graph SDK
20
+
> * Update the user interface to display user information from [Microsoft Graph](/graph/)
21
+
22
+
## Prerequisites
23
+
24
+
* An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/).
25
+
* The .NET MAUI [installation requirements](/dotnet/maui/get-started/installation).
26
+
* If you are new to .NET MAUI on Windows, you should start with the [Build your first .NET MAUI app for Windows](/windows/apps/windows-dotnet-maui/walkthrough-first-app) tutorial.
17
27
18
28
## Setting up the environment
19
29
@@ -325,7 +335,13 @@ Run the app again and click the **Load User Info** button. You should see your u
325
335
326
336
To learn how to install and get started with the Microsoft Graph SDK in your .NET MAUI apps, see [Install the Microsoft Graph .NET SDK](/graph/sdks/sdk-installation#install-the-microsoft-graph-net-sdk).
327
337
328
-
## Related topics
338
+
## Next steps
339
+
340
+
Advance to the next article to learn how to...
341
+
> [!div class="nextstepaction"]
342
+
> [Create a recommendation app with .NET MAUI and ChatGPT](tutorial-maui-ai.md)
343
+
344
+
## See also
329
345
330
346
[Resources for learning .NET MAUI](/dotnet/maui/get-started/resources)
Copy file name to clipboardExpand all lines: hub/apps/windows-dotnet-maui/tutorial-maui-ai.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -199,6 +199,13 @@ It's time to add the code to our code-behind file that will use the ChatGptNet l
199
199
200
200
This code first checks to make sure the user has entered a location in the `Entry` control. If not, it displays an alert and returns. If the user has entered a location, it calls the `AskAsync` method on the ChatGptNet library to make a call to the OpenAI ChatGPT API. The `AskAsync` method takes two parameters: a `Guid` that identifies the user's session and a string containing the question to ask the API. The `AskAsync` method returns a `ChatGptResponse` object that contains the response from the API. We'll use the `GetMessage` method on the `ChatGptResponse` object to get the response text and display it in the `Label` control at the bottom of the UI.
201
201
202
+
1. Add the following `using` statements to the top of the **MainPage.xaml.cs** file:
203
+
204
+
```csharp
205
+
using ChatGptNet;
206
+
using ChatGptNet.Models;
207
+
```
208
+
202
209
1. Run the app, enter a location, and test the recommendation buttons. You should see a response from the API in the `Label` control at the bottom of the UI:
203
210
204
211

0 commit comments