「東雲 忠太郎」の平凡な日常のできごと

「東雲 忠太郎」の平凡な日常のできごと

2024.02.22
XML
カテゴリ: VB.NET


Imports Microsoft.Xrm.Tooling.Connector

Imports Microsoft.PowerPlatform.Cds.Client

Imports Microsoft.PowerPlatform.Cds.Client.Query


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", "address1_city", "address1_country")


            ' Execute the query

            Dim entities As EntityCollection = svc.RetrieveMultiple(query)


            ' Display retrieved data

            For Each entity As Entity In entities.Entities

                Console.WriteLine($"Name: {entity.GetAttributeValue(Of String)("name")}, City: {entity.GetAttributeValue(Of String)("address1_city")}, Country: {entity.GetAttributeValue(Of String)("address1_country")}")

            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:22:59


【毎日開催】
15記事にいいね!で1ポイント
10秒滞在
いいね! -- / --
おめでとうございます!
ミッションを達成しました。
※「ポイントを獲得する」ボタンを押すと広告が表示されます。
x

© Rakuten Group, Inc.
Create a Mobile Website
スマートフォン版を閲覧 | PC版を閲覧
Share by: