Thursday, November 07, 2013

Code snippet to increase Aggregate Query Record Limit


Use the code template from here

Code:
DeploymentServiceClient service = Microsoft.Xrm.Sdk.Deployment.Proxy.ProxyClientHelper.CreateClient(new Uri("http://crmtest/XRMDeployment/2011/Deployment.svc"));

                RetrieveAdvancedSettingsRequest request3 = new RetrieveAdvancedSettingsRequest()
                {
                    ConfigurationEntityName = "Deployment", ColumnSet = new ColumnSet(false)
                };
                RetrieveAdvancedSettingsResponse response3 = (RetrieveAdvancedSettingsResponse)service.Execute(request3);
                ConfigurationEntity configEntity = response3.Entity;

                ConfigurationEntity entity = new ConfigurationEntity();
                entity.LogicalName = "Deployment";
                entity.Attributes = new Microsoft.Xrm.Sdk.DeploymentAttributeCollection();
                entity.Attributes.Add(new KeyValuePair<string, object>("AggregateQueryRecordLimit", 50000));
                     
                UpdateAdvancedSettingsRequest request2 = new UpdateAdvancedSettingsRequest();
                request2.Entity = entity;
                service.Execute(request2);



Update the deployment service URL 

No comments: