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: "Quickstart: Organization service sample (C#) (Microsoft Dataverse) | Microsoft Docs"# Intent and product brand in a unique string of 43-59 chars including spaces
3
-
description: "This quick start will show you how to connect to the Organization service of Microsoft Dataverse."# 115-145 characters including spaces. This abstract displays in the search result.
4
-
ms.date: 09/30/2022
5
-
author: JimDaly
6
-
ms.author: jdaly
2
+
title: "Quickstart: Execute an Organization service request (C#) (Microsoft Dataverse) | Microsoft Docs"# Intent and product brand in a unique string of 43-59 chars including spaces
3
+
description: "Demonstrates how to connect to the Organization service of Microsoft Dataverse and execute a request."# 115-145 characters including spaces. This abstract displays in the search result.
4
+
ms.date: 10/05/2022
5
+
author: phecke
6
+
ms.author: pehecke
7
7
manager: kvivek
8
-
ms.reviewer: pehecke
8
+
ms.reviewer: jdaly
9
9
ms.topic: "article"
10
10
search.audienceType:
11
11
- developer
@@ -16,16 +16,17 @@ contributors:
16
16
- JimDaly
17
17
- phecke
18
18
---
19
-
# Quickstart: Organization service sample (C#)
19
+
20
+
# Quickstart: Execute an Organization service request (C#)
This topic shows you how to begin using classes in the SDK for .NET assemblies to work with Microsoft Dataverse business data. You will create a minimal console application to connect to your environment's Organization service using the <xref:Microsoft.PowerPlatform.Dataverse.Client.ServiceClient> class and execute a web service operation.
24
25
25
-
Your application will call the <xref:Microsoft.Xrm.Sdk.IOrganizationService>.<xref:Microsoft.Xrm.Sdk.IOrganizationService.Execute*> method passing an instance of the <xref:Microsoft.Crm.Sdk.Messages.WhoAmIRequest> class. The result returned from the web service is a populated <xref:Microsoft.Crm.Sdk.Messages.WhoAmIResponse>.<xref:Microsoft.Crm.Sdk.Messages.WhoAmIResponse.UserId> value which is the identifier of your Dataverse user account.
26
+
Your application will call the <xref:Microsoft.Xrm.Sdk.IOrganizationService>.<xref:Microsoft.Xrm.Sdk.IOrganizationService.Execute*> method passing an instance of the <xref:Microsoft.Crm.Sdk.Messages.WhoAmIRequest> class. The result returned from the web service is a populated <xref:Microsoft.Crm.Sdk.Messages.WhoAmIResponse>.<xref:Microsoft.Crm.Sdk.Messages.WhoAmIResponse.UserId> value which is the unique identifier of your Dataverse system user account.
26
27
27
28
> [!NOTE]
28
-
> This quick start example does not include error handling for brevity. This is a minimum code example of what you need to connect to and use the Organization service.
29
+
> This quick start example does not include exception handling for brevity. This is a minimum code example of what you need to connect to and use the Organization service.
29
30
30
31
## Prerequisites
31
32
@@ -37,103 +38,94 @@ Your application will call the <xref:Microsoft.Xrm.Sdk.IOrganizationService>.<xr
37
38
38
39
## Create Visual Studio project
39
40
40
-
1. Create a new .NET console app project. For this project we are demonstrating .NET 6, but .NET Framework will also work.
41
+
1. Create a new .NET console app project. For this project we are Visual Studio 2022 and targeting .NET 6, but .NET Framework will also work.
41
42
42
43

43
44
44
-
> [!NOTE]
45
-
> This screenshot shows the name `OrgServiceQuickStart`, but you can choose to name the project and solution whatever you want.
46
-
47
45
1. In **Solution Explorer**, right-click the project you created and select **Manage NuGet Packages...** in the context menu.
Console.WriteLine("User ID is {0}.", response.UserId);
93
+
}
94
+
else
95
+
{
96
+
Console.WriteLine(
97
+
"A web service connection was not established.");
98
+
}
99
+
}
100
+
101
+
// Pause the console so it does not close.
98
102
Console.WriteLine("Press any key to exit.");
99
103
Console.ReadLine();
100
104
}
101
105
}
102
106
```
103
107
104
-
1. Editthefollowingvaluestoaddinformationfor your environment. You can find your environment URL in the Web application under **Settings > Customization > Developer Resources**.
1. Changethevaluesfor the environment URL, username, and password as indicated by the TODO code comment.
109
+
You can find supported values for *AuthType* listed in [Connection string parameters](../xrm-tooling/use-connection-strings-xrm-tooling-connect.md). YoucanfindyourenvironmentURLinthelegacywebapplicationunder**Settings>Customization>DeveloperResources**orinPowerApps**Settings** (gearicon) >**DeveloperResources**.
0 commit comments