locked
Bulk Deletion query RRS feed

  • Question

  • Hi All,

    I am using the below code to initiate a Bulk Delete Request to delete the Activities which are created on or Before 01/01/2011.  The Bulk deletion Request is created successfully but it fails for all the record with the error  “Invalid RecipientType” error
     
     
    WhoAmIRequest userRequest = new WhoAmIRequest();
                    WhoAmIResponse currentUser = (WhoAmIResponse)service.Execute(userRequest);
                    Guid userId = currentUser.UserId;
     
                 ConditionExpression condActivities = new ConditionExpression();
                condActivities.AttributeName = "createdon";
                condActivities.Operator = ConditionOperator.OnOrBefore;
                condActivities.Values = new string[] { "1/1/2011" };
     
                FilterExpression filterActivities = new FilterExpression();
                filterActivities.Conditions = new ConditionExpression[] { condActivities };
                filterActivities.FilterOperator = LogicalOperator.And;
     
                QueryExpression queryActivities = new QueryExpression();
                queryActivities.ColumnSet = new AllColumns();
                queryActivities.EntityName = EntityName.activitypointer.ToString();
                queryActivities.Criteria = filterActivities;
     
                BulkDeleteRequest request = new BulkDeleteRequest();
                request.QuerySet = new QueryBase[] { queryActivities };
                request.JobName = "Bulk Delete Job";
                request.SendEmailNotification = false;
                request.RecurrencePattern = string.Empty;
                request.ToRecipients = new Guid[] { userId };
                request.CCRecipients = new Guid[]{userId};
                request.StartDateTime = new CrmDateTime();
                request.StartDateTime.Value = DateTime.Now.ToString();
     
                BulkDeleteResponse response = (BulkDeleteResponse)service.Execute(request);
     
    Any Suggestions?.
    Friday, February 25, 2011 5:41 PM

Answers

  • Looks like issue is because you are using the entity “activitypointer“  in filter expression which does not support delete SDK message. Are you able to delete records using direct SDK calls?

     

    Monday, February 28, 2011 9:20 AM

All replies

  • Change these line to:-

         request.ToRecipients = new Guid[0];
         request.CCRecipients = new Guid[0];

         request.StartDateTime.Value = DateTime.Now.ToString("s");

    Add last line:-


             Guid jobId = response.JobId;


    Regards Faisal
    Friday, February 25, 2011 6:02 PM
  • Looks like issue is because you are using the entity “activitypointer“  in filter expression which does not support delete SDK message. Are you able to delete records using direct SDK calls?

     

    Monday, February 28, 2011 9:20 AM