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: powerapps-docs/developer/common-data-service/webapi/quick-start-blazor-server-app.md
+23-18Lines changed: 23 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: "Quick Start: Web API sample (C#) (Common Data Service)| Microsoft Docs"
2
+
title: "Quickstart: Web API sample (C#) (Common Data Service)| Microsoft Docs"
3
3
description: "This sample demonstrates how to authenticate with a Common Data Service Server and then call a basic Web API operation, the WhoAmI Function"
4
4
ms.custom: ""
5
5
ms.date: 06/23/2020
@@ -15,31 +15,31 @@ search.app:
15
15
- PowerApps
16
16
- D365CE
17
17
---
18
-
# Quick Start: Blazor Server Web API sample (C#)
18
+
# Quickstart: Blazor Server Web API sample (C#)
19
19
20
-
In this quick start you will create a simple Blazor Server application to connect to your Common Data Service environment using the Web API.
20
+
In this quickstart, you'll create a Blazor Server application to connect to your Common Data Service environment using the Web API.
21
21
22
-
You will authenticate and use an <xref:System.Net.Http.HttpClient> to send a `GET` request to the <xrefhref="Microsoft.Dynamics.CRM.WhoAmI?text=WhoAmI Function" /> the response will be a <xrefhref="Microsoft.Dynamics.CRM.WhoAmIResponse?text=WhoAmIResponse ComplexType" />. You will display the `UserId` property value.
22
+
You'll authenticate and use an <xref:System.Net.Http.HttpClient> to send a `GET` request to the <xrefhref="Microsoft.Dynamics.CRM.WhoAmI?text=WhoAmI Function" /> the response will be a <xrefhref="Microsoft.Dynamics.CRM.WhoAmIResponse?text=WhoAmIResponse ComplexType" />. You will display the `UserId` property value.
23
23
24
24
> [!NOTE]
25
-
> This is a very simple example to show how to get connected with a minimum of code. The following [Enhanced quick start](enhanced-quick-start.md) will build upon this sample to apply better design patterns.
25
+
> This is a very simple example to show how to get connected with a minimum of code. The following [Enhanced quickstart](enhanced-quick-start.md) will build upon this sample to apply better design patterns.
26
26
27
27
## Prerequisites
28
28
29
29
- Visual Studio (2019 16.6.2 recommended)
30
-
- Familiarity with the Azure Portal
30
+
- Familiarity with the Azure portal
31
31
- Internet connection
32
32
- Valid user account for a Common Data Service instance
33
33
- Admin access to grant application registrations
34
34
- URL to the Common Data Service environment you want to connect with
35
35
- Basic understanding of the Visual C# language
36
36
37
37
> [!NOTE]
38
-
> 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.
38
+
> 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.
39
39
40
40
## Create Visual Studio project
41
41
42
-
1. Create a new Blazor Server App using **.NET Core 3.1** - do _not_ click "Create" yet
42
+
1. Create a new Blazor Server App using **.NET Core 3.1** - _don't_ click "Create" yet
43
43
44
44

45
45
@@ -51,11 +51,11 @@ You will authenticate and use an <xref:System.Net.Http.HttpClient> to send a `GE
51
51
52
52
## Configure the Application in Active Directory
53
53
54
-
By default, the template will create a registered application. To connect to Common Data Services requires additional permissions. Open the Azure Portal and log in with your credentials. Navigate to "Active Directory" and "App Registrations" and choose the entry with the same name as your application.
54
+
By default, the template will create a registered application. Connecting to Common Data Services will require additional permissions. Open the Azure portal and log in with your credentials. Navigate to "Active Directory" and "App Registrations" and choose the entry with the same name as your application.
55
55
56
56
1. Choose "Authentication" and check "Access tokens" under "Implicit grant" then click "Save".
1. Choose "Certificates & secrets" and click "New client secret"
61
61
@@ -127,10 +127,10 @@ The application requires some extra steps to capture the authentication token an
127
127
128
128
1. Open `Pages/_Host.cshtml` and add the following using statements after the namespace declaration:
129
129
130
-
```razor
131
-
@using BlazorCommonDataService.Data
132
-
@using Microsoft.AspNetCore.Authentication
133
-
```
130
+
```razor
131
+
@using BlazorCommonDataService.Data
132
+
@using Microsoft.AspNetCore.Authentication
133
+
```
134
134
135
135
1. After the `<body>` tag, add the following code and update the app component to acquire and pass the token:
136
136
@@ -146,7 +146,7 @@ The application requires some extra steps to capture the authentication token an
146
146
</app>
147
147
```
148
148
149
-
1. Obtain the ___domain for the Common Data Services management API. One way to do this is to open the [Power Platform admin center](https://admin.powerplatform.microsoft.com/environments), navigate to "environments" then choose "open environment." You should see a URL like: `https://{org}.crm.dynamics.com`
149
+
1. Obtain the organization name for the Common Data Services management API. If you're not sure what the name is, open the [Power Platform admin center](https://admin.powerplatform.microsoft.com/environments), navigate to "environments" then choose "open environment." You will see a URL like this: `https://{org}.crm.dynamics.com`
150
150
151
151
1. Add an entry to `appsettings.json` named `CDSAPI` with the URL. Add `/api/data/v.9.0/` to the end, so it looks like this:
152
152
@@ -257,13 +257,18 @@ Press F5 to run the program. The output should look like this:
257
257
258
258
**Congratulations!** You have successfully connected to the Web API.
259
259
260
-
The quick start sample shows a simple approach to create a Visual Studio project without any exception handling or method to refresh the access token. You can expand on the example to perform more complex operations, and wrap the `HttpClient` in a service class to handle the permissions.
260
+
This quickstart sample shows a simple approach to create a Visual Studio project without any exception handling or method to refresh the access token. You can expand on the example to perform more complex operations, and wrap the `HttpClient` in a service class to handle the permissions.
261
+
262
+
The [Enhanced quickstart](enhanced-quick-start.md) topic shows how to:
261
263
262
-
The [Enhanced quick start](enhanced-quick-start.md) topic shows how to implement exception handling methods, basic authentication method using connection string, a re-usable method to refresh the access token, and introduces how to build re-usable methods to perform data operations.
264
+
- implement exception handling methods
265
+
- basic authentication method using a connection string
266
+
- create a reusable method to refresh the access token
267
+
- build reusable methods for data operations
263
268
264
269
## Next steps
265
270
266
271
Learn how to structure your code for a better design.
0 commit comments