全て
| カテゴリ未分類
| 通常
| 数学
| 投資
| 副業
| 転職・就職
| ブログ
| 株Stock
| VBA
| SharePoint
| REST API
| RenderListDataAsStream
| PowerAutomateDesktop
| Graph API
| PowerApps
| PowerAutomate
| PowerFx
| OfficeScriptオフィススクリプト
| PowerAutomate日時Excel日時相互関係
| PowerShell
| Dataverse
| UiPath
| OneDrive
| LINQ
| VB.NET
| C#.NET
| WPFC#.NET
| Git
カテゴリ:VB.NET
Imports Microsoft.Xrm.Tooling.Connector Imports Microsoft.PowerPlatform.Cds.Client Imports Microsoft.PowerPlatform.Cds.Client.Query Imports System.Linq Module Module1 Sub Main() Dim connectionString As String = "AuthType=OAuth;Username=yourusername@yourtenant.onmicrosoft.com;Password=yourpassword;Url=https://yourorg.crm.dynamics.com;AppId=51f81489-12ee-4a9e-aaae-a2591f45987d;RedirectUri=app://58145B91-0C36-4500-8554-080854F2AC97;LoginPrompt=Auto" ' Create a new instance of the CrmServiceClient Dim svc As New CdsServiceClient(connectionString) ' Check if the connection is successful If svc.IsReady Then Console.WriteLine("Connection successful") ' Define query expression Dim query As New QueryExpression("account") query.ColumnSet.AddColumns("name", "revenue") ' Group by name and get maximum revenue for each group query.AddAggregation("name", AggregateType.GroupBy) query.AddAggregation("revenue", AggregateType.Max, "max_revenue") ' Execute the query Dim entities As EntityCollection = svc.RetrieveMultiple(query) ' Display retrieved data For Each entity As Entity In entities.Entities Dim name As String = entity.GetAttributeValue(Of String)("name") Dim maxRevenue As Decimal = If(entity.Contains("max_revenue"), entity.GetAttributeValue(Of Money)("max_revenue").Value, 0) Console.WriteLine($"Name: {name}, Max Revenue: {maxRevenue}") Next Else Console.WriteLine("Connection failed") End If ' Close the connection svc.Dispose() Console.ReadLine() End Sub End Module お気に入りの記事を「いいね!」で応援しよう
Last updated
2024.02.22 06:25:52
[VB.NET] カテゴリの最新記事
|