Dynamics 365 – 实体 ER 图 (Visio) 在 SDK 中使用元数据图控制台

Dynamics 365 – Entities ER Diagram (Visio) using Metadata Diagram Console in SDK

我在使用 D365 v9.1,需要从 CRM 为我团队中的数据架构师创建一个 E/R 图表。我知道...我知道...为什么我不直接使用 xRM Toolbox 提供的 E/R 图表创建器?那么,xRM 工具箱提供的工具只允许我将文件另存为 .erd。我的数据架构师开始使用 Erwin,并且一直在努力将 .erd 文件导入 Erwin w/o 失败。因此找到了使用 Dynamics 365 – 实体 ER 图 (Visio) 使用 SDK 中的元数据图控制台的解决方法(这将允许我将输出的 Visio 文件导入 Erwin):https://www.microsoft.com/en-us/download/confirmation.aspx?id=50032 . This targets 8.x however there is a workaround by modifying the code behind here https://sachinbansal.blog/2018/03/29/dynamics-365-entities-er-diagram-visio-using-metadata-diagram-console-in-sdk/。问题是我已经完全按照说明修改了后面的代码,但收到以下错误:

以下是允许通过 TLS 1.2 与 9.x 通信的代码块。同样,我已经进行了推荐的修改,但仍然收到错误。

 try
                {
                    // Obtain the target organization’s Web address and client logon
                    // credentials from the user.
                    //ServerConnection serverConnect = new ServerConnection();
                    //ServerConnection.Configuration config = serverConnect.GetServerConfiguration();
                    string strUrl = string.Empty;
                    strUrl = “https://<orgname>.api.crm9.dynamics.com/XRMServices/2011/Organization.svc“;
                    ClientCredentials credential = new ClientCredentials();
                    credential.UserName.UserName = “*********.onmicrosoft.com”;
                    credential.UserName.Password = “***************”;
                    // Set security protocol to TLS 1.2 for version 9.0 of Customer Engagement Platform
                    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                    // Connect to the Organization service.
      // The using statement assures that the service proxy will be properly   disposed.
    using (_serviceProxy = new OrganizationServiceProxy(new Uri(strUrl), null, credential, null))
                    {
                        // This statement is required to enable early-bound type support.
                        _serviceProxy.EnableProxyTypes();
                        _serviceProxy.Timeout = TimeSpan.MaxValue;
                        // Load Visio and create a new document.
                        application = new VisioApi.Application();
    application.Visible = false; // Not showing the UI increases       rendering speed
                        builder.VersionName = application.Version;
                        document = application.Documents.Add(String.Empty);
                        builder._application = application;
                        builder._document = document;

此问题的解决方案是从 CRM SDK 中删除特定于版本 8.x 的所有引用并重新加载 9.x 版本开发指南程序集并重建针对 .NET 版本 4.6 的解决方案。 1.