Search code examples
dynamics-crmentity-relationshipmicrosoft-dynamicsdiagramdynamics-365

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


I am on D365 v9.1 and need to create a E/R diagram from CRM for the Data Architect on my team. I know...I know....why don't I just use the E/R diagram creator provided by xRM Toolbox? Well, the tool provided by xRM toolbox is only allowing me to save file as .erd. My data architect is set on using Erwin and have been fighting to import the .erd file to Erwin w/o failure. So found a work around using the Dynamics 365 – Entities ER Diagram (Visio) using Metadata Diagram Console in SDK found here (which will allow me to import the outputted Visio file to 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/ . The problem is that I've modified the code behind EXACTLY as stated but am receiving the following errors:

enter image description here The following is the block of code that allows to communicate with 9.x via TLS 1.2 Again, I have made the modifcations recommended and receiving errors still.

 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;

Solution

  • Solution to this problem was to remove all the references from CRM SDK that were specific to version 8.x and reload the 9.x version Develops Guide assemblies and rebuild the solution targeting .NET version 4.6.1.