Search code examples
c#.netdynamics-crm-2015

Retrieve all entities in a solution CRM


I am struggling with CRM currenly trying to get a list of all entities from a solution. This is the code that I have so far where i can retrieve a solution and get it's name etc but I can't figure out how to interact with components within the solution

            Microsoft.Xrm.Client.CrmConnection connection = CrmConnection.Parse("Url=https://hidden.crm4.dynamics.com; [email protected]; Password=hidden;");
            OrganizationService service = new OrganizationService(connection);
            Console.WriteLine("Connected");

            // Retrieve the solution
            string solutionName = "Testsolution";
            QueryExpression queryGetSolution = new QueryExpression
            {
                EntityName = Solution.EntityLogicalName,
                ColumnSet = new ColumnSet(new string[] { "publisherid", "installedon", "version", "versionnumber", "friendlyname" }),
                Criteria = new FilterExpression()
            };
            queryGetSolution.Criteria.AddCondition("uniquename", ConditionOperator.Equal, solutionName);
            Solution solution = (Solution)service.RetrieveMultiple(queryGetSolution).Entities[0];

Now I can look at the attributes retrieved for that solution but what I want is to see what entities exist in there and later on be able to update some of their attributes


Solution

  • Have you looked at this post? https://simonetagliaro.wordpress.com/2012/10/02/retrieve-all-the-entities-within-a-solution-crm-2011/

    Its for CRM 2011 however should still do the trick.