/// <summary>
        /// Called after Import completes.
        /// </summary>
        /// <returns>true, if solution deployed and schema imported successfully, exception otherwise</returns>
        public override bool AfterPrimaryImport()
        {
            OrganizationRequest request = new OrganizationRequest()
            {
                RequestName = "ImportCardTypeSchema"
            };

            request["SolutionUniqueName"] = "ExtensibilityExample";
            CrmSvc.Execute(request);
            return(true);
        }
Exemple #2
0
        private void CreateBulkDeleteJob(int months)
        {
            if (!BulkDeleteJobExists())
            {
                string frequency =
                    String.Format(System.Globalization.CultureInfo.InvariantCulture,
                                  "FREQ=DAILY;INTERVAL={0};", DailyInterval);


                QueryExpression query = new QueryExpression
                {
                    EntityName = "msdyn_analysisresult",
                    ColumnSet  = new ColumnSet("msdyn_name"),
                    Criteria   = new FilterExpression
                    {
                        Conditions =
                        {
                            new ConditionExpression
                            {
                                AttributeName = "createdon",
                                Operator      = ConditionOperator.OlderThanXMonths,
                                Values        = { months }
                            }
                        }
                    }
                };

                BulkDeleteRequest bulkDeleteRequest =
                    new BulkDeleteRequest
                {
                    JobName               = jobName,
                    QuerySet              = new QueryExpression[] { query },
                    StartDateTime         = DateTime.Now.Date,
                    RecurrencePattern     = frequency,
                    SendEmailNotification = false,
                    ToRecipients          = new Guid[] { },
                    CCRecipients          = new Guid[] { }
                };

                CrmSvc.Execute(bulkDeleteRequest);
            }
        }