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
title: "Get started with Microsoft Dataverse Web API (C#) (Dataverse)| Microsoft Docs"
3
-
description: "Learn how to access the Microsoft Dataverse Web API using the Microsoft Visual C# programming language"
4
-
ms.date: 04/06/2022
2
+
title: "Get started with Dataverse Web API (C#) (Dataverse)| Microsoft Docs"
3
+
description: "Learn how to access the Dataverse Web API using the Microsoft Visual C# programming language."
4
+
ms.date: 06/22/2023
5
5
author: divkamath
6
6
ms.author: dikamath
7
7
ms.reviewer: jdaly
@@ -10,21 +10,25 @@ search.audienceType:
10
10
contributors:
11
11
- JimDaly
12
12
---
13
-
# Get started with Microsoft Dataverse Web API (C#)
13
+
# Get started with the Dataverse Web API (C#)
14
14
15
-
This section shows you how to access the Dataverse Web API using the C# programming language. The first topic, [Quick Start: Web API sample (C#)](quick-start-console-app-csharp.md), provides the quickest example of how to accomplish this, as all source code is simplified and provided in one file. The rest of this section shows you how to create and configure Visual Studio projects that use the Dataverse Web API to perform common business data operations.
16
-
17
-
After completing this guide, you will have learned enough to explore the many other business operations that are supported by the Dataverse Web API. You will also have a better understanding about how the [Web API Samples (C#)](web-api-samples-csharp.md) are structured.
15
+
This section introduces some simple ways start accessing the Dataverse Web API using the C# programming language.
16
+
17
+
-[Quick Start: Web API sample (C#)](quick-start-console-app-csharp.md), provides the quickest example of how to access data, as all source code is simplified and provided in one file.
18
+
-[Quickstart: Blazor Server Web API sample (C#)](quick-start-blazor-server-app.md) shows how to create a web application that can connect to Dataverse and retrieve data using the Web API.
19
+
20
+
21
+
To learn more, please explore the [Web API Samples (C#)](web-api-samples-csharp.md).
18
22
19
23
## In this section
20
24
21
-
[Quick Start: Web API sample](quick-start-console-app-csharp.md) (Do this first)
22
-
[Enhanced quick start](enhanced-quick-start.md) (Do this next)
23
-
[Start a Dataverse Web API project in Visual Studio](start-web-api-project-visual-studio-csharp.md)
25
+
[Quick Start: Web API sample](quick-start-console-app-csharp.md)
26
+
[Quickstart: Blazor Server Web API sample (C#)](quick-start-blazor-server-app.md)
24
27
25
28
### See also
26
29
27
-
[Perform operations using the Web API](perform-operations-web-api.md)<br />
28
-
[Web API Samples (C#)](web-api-samples-csharp.md)
30
+
[Perform operations using the Web API](perform-operations-web-api.md)
31
+
[Web API Samples (C#)](web-api-samples-csharp.md)
32
+
[Set up a Postman environment](setup-postman-environment.md)
Copy file name to clipboardExpand all lines: powerapps-docs/developer/data-platform/webapi/quick-start-blazor-server-app.md
+48-41Lines changed: 48 additions & 41 deletions
Original file line number
Diff line number
Diff line change
@@ -11,93 +11,93 @@ search.audienceType:
11
11
---
12
12
# Quickstart: Blazor Server Web API sample (C#)
13
13
14
-
In this quickstart, you'll create a Blazor Server application to connect to your Microsoft Dataverse environment using the Web API.
14
+
In this quickstart, you create a Blazor Server application to connect to your Microsoft Dataverse environment using the Web API.
15
15
16
-
You'll authenticate and use <xref:System.Net.Http.HttpClient> to send a `GET` request containing the [WhoAmI Function](xref:Microsoft.Dynamics.CRM.WhoAmI). The response will be a [WhoAmIResponse ComplexType ](xref:Microsoft.Dynamics.CRM.WhoAmIResponse). After call completion, the `WhoAmIResponse` properties are displayed.
16
+
You authenticate and use <xref:System.Net.Http.HttpClient> to send a `GET` request containing the [WhoAmI Function](xref:Microsoft.Dynamics.CRM.WhoAmI). The response is a [WhoAmIResponse ComplexType ](xref:Microsoft.Dynamics.CRM.WhoAmIResponse). After call completion, the `WhoAmIResponse` properties are displayed.
17
17
18
18
> [!NOTE]
19
19
> This is a very simple example to show how to get connected with a minimum of code.
20
20
21
21
## Prerequisites
22
22
23
23
- Visual Studio 2022 with the **ASP.NET and web development** workload.
- Administrator access to grant application registrations.
29
+
- URL to the Dataverse environment you want to connect with.
30
+
- Basic understanding of the Visual C# language.
31
31
32
32
33
33
> [!NOTE]
34
34
> To authenticate you must have an app registered in Azure Active Directory. The registration will happen automatically as part of the template creation, but will require additional updates in the Azure portal.
35
35
36
36
## Create a Visual Studio project
37
37
38
-
1. Open Visual Studio 2022 and click**Create a new project**.
38
+
1. Open Visual Studio 2022 and select**Create a new project**.
39
39
40
40
:::image type="content" source="../media/quick-start-blazor-server-app-csharp-1.png" alt-text="Open Visual Studio 2022":::
41
41
42
-
1. In the **Create a new project** dialog, search for *Blazor Server App*. Select the template and click**Next**.
42
+
1. In the **Create a new project** dialog, search for *Blazor Server App*. Select the template and select**Next**.
43
43
44
44
:::image type="content" source="../media/quick-start-blazor-server-app-csharp-2.png" alt-text="Create a new project":::
45
45
46
-
1. In the **Configure your new project** dialog, set the **Project name**, and **Location**. Then click**Next**.
46
+
1. In the **Configure your new project** dialog, set the **Project name**, and **Location**. Then select**Next**.
47
47
48
48
:::image type="content" source="../media/quick-start-blazor-server-app-csharp-2.5.png" alt-text="Enter project name and ___location":::
49
49
50
-
In this example we will use **DataverseWebApiBlazorServerQuickStart** as the **Project name**.
50
+
In this example, we'll use **DataverseWebApiBlazorServerQuickStart** as the **Project name**.
51
51
52
-
1. In the **Additional information** dialog specify **Framework** and **Authentication type**.
52
+
1. In the **Additional information** dialog, specify **Framework** and **Authentication type**.
53
53
54
-
In this example the Framework is **.NET 7.0 (Standard Term Support)**
54
+
In this example, the Framework is **.NET 7.0 (Standard Term Support)**.
55
55
56
56
> [!IMPORTANT]
57
-
> Set the **Authentication type** to **Microsoft identity platform**
57
+
> Set the **Authentication type** to **Microsoft identity platform**.
58
58
59
59
:::image type="content" source="../media/quick-start-blazor-server-app-csharp-3.png" alt-text="Set the Authentication type to Microsoft identity platform":::
60
60
61
-
1.Click**Create** to create the project.
62
-
1. The project template opens a **Required components** dialog. Click**Next**.
61
+
1.Select**Create** to create the project.
62
+
1. The project template opens a **Required components** dialog. Select**Next**.
1. In the **Microsoft identity platform** dialog, make sure that the selected Azure account has permissions to manage applications in Azure AD and the selected tenant is the one associated with your Power Platform environment.
1. In the **Register an application** dialog, set the **Display name** and click**Register** to close the dialog.
70
+
1.Select**Create new**.
71
+
1. In the **Register an application** dialog, set the **Display name** and select**Register** to close the dialog.
72
72
73
73
:::image type="content" source="../media/quick-start-blazor-server-app-csharp-6.png" alt-text="Register an application":::
74
74
75
-
In this example we are using the name *Dataverse Web Api Blazor Server Quick Start*. We will search for the application using this name in a later step.
75
+
In this example, we're using the name *Dataverse Web Api Blazor Server Quick Start*. We'll search for the application using this name in a later step.
76
76
77
-
1.Click**Next**.
77
+
1.Select**Next**.
78
78
79
79
> [!NOTE]
80
80
> You don't need to do anything in this step.
81
81
82
-
This step provides capabilities to connect to Microsoft Graph or another API, but this isn't necessary for this quickstart.
82
+
This step provides capabilities to connect to Microsoft Graph or another API, but connecting to another API isn't necessary for this quickstart.
The Visual Studio template created a registered application using the information you provided. Connecting to Dataverse requires additional permissions.
100
+
The Visual Studio template created a registered application using the information you provided. Connecting to Dataverse requires more permissions.
101
101
102
102
1. From the [Power Platform admin center](https://admin.powerplatform.microsoft.com/home), select the **Azure Active Directory** admin center.
103
103
@@ -107,24 +107,24 @@ The Visual Studio template created a registered application using the informatio
107
107
108
108
:::image type="content" source="../media/quick-start-blazor-server-app-csharp-9.png" alt-text="Search for the application registration":::
109
109
110
-
1. Open the application and select **API permissions**. Click**Add a permission**.
110
+
1. Open the application and select **API permissions**. Select**Add a permission**.
1. In the **Add a client secret** fly-out, enter a **Description** and **Expires** duration, then click**Add**.
127
+
1. In the **Add a client secret** fly-out, enter a **Description** and **Expires** duration, then select**Add**.
128
128
129
129
:::image type="content" source="../media/quick-start-blazor-server-app-csharp-14.png" alt-text="Add a client secret":::
130
130
@@ -157,17 +157,17 @@ The Visual Studio template created a registered application using the informatio
157
157
158
158
## Edit the app
159
159
160
-
To enable calls to Dataverse you must edit three files in the application:
160
+
To enable calls to Dataverse, you must edit three files in the application:
161
161
162
162
- appsettings.json
163
163
- Program.cs
164
164
- Pages/FetchData.razor
165
165
166
166
### appsettings.json
167
167
168
-
There are several places in the other files that require a reference to the base uri used to access the Dataverse Web API. Adding this to the `appsettings.json` allows you to set this in one place.
168
+
There are several places in the other files that require a reference to the base uri used to access the Dataverse Web API. Adding this data to the `appsettings.json` allows you to set this data in one place.
169
169
170
-
Add the following below `"AllowedHosts": "*"` where `<your org>` represents the base url to access the Dataverse Web API. If you are not sure what this is, see [Web API URL and versions](compose-http-requests-handle-errors.md#web-api-url-and-versions).
170
+
Add the following below `"AllowedHosts": "*"` where `<your org>` represents the base url to access the Dataverse Web API. If you aren't sure what this is, see [Web API URL and versions](compose-http-requests-handle-errors.md#web-api-url-and-versions).
171
171
172
172
```json
173
173
"AllowedHosts": "*",
@@ -204,14 +204,14 @@ Add the following below `"AllowedHosts": "*"` where `<your org>` represents the
0 commit comments