Create a quick campaign by code

This question is not answered

I need create a quick campaign with visual studio 2005 c#.

But when i try it, a exception appears :

0x80040800

The method being invoked does not support provided entity type.

Platform

my code is the next:

bulkoperation Bulk = new bulkoperation();

Bulk.actualend = new CrmDateTime();

Bulk.actualend.Value = "2009-01-21T16:50:46+01:00";Bulk.actualstart = new CrmDateTime();

Bulk.actualstart.Value = "2009-01-21T16:50:30+01:00";

Bulk.createdrecordtypecode = new Picklist();Bulk.createdrecordtypecode.name = "Llamada de teléfono";

Bulk.createdrecordtypecode.Value = 1;

Bulk.isbilled = new CrmBoolean();

Bulk.isbilled.Value = true;

Bulk.isworkflowcreated = new CrmBoolean();

Bulk.isworkflowcreated.Value = false;

Bulk.operationtypecode = new Picklist();Bulk.operationtypecode.name = "Campaña exprés";

Bulk.operationtypecode.Value = 7;

Bulk.parameters = "<params><param name='activityXml'><![CDATA[<phonecall><directioncode>1</directioncode><subject>Prueba de envio masivo desde una campa&#xF1;a express</subject><description>hola ha sido seleccionado para participar en un sorteo de una torre en marvella&#x21;&#x21;&#x0D;&#x0A;&#x0D;&#x0A;para verificar que ha recivido correctamente este mail debe llamar al telefono 11111111 para reclamar su premio&#x21;&#x21;</description><new_colaborador>0</new_colaborador><actualdurationminutes>30</actualdurationminutes><prioritycode>1</prioritycode><scheduledend>2009-01-23T00:00:00</scheduledend><statuscode>1</statuscode></phonecall>]]></param><param name='activityObjectTypeCode'><![CDATA[4210]]></param><param name='propagate'><![CDATA[True]]></param><param name='templateId'><![CDATA[{00000000-0000-0000-0000-000000000000}]]></param><param name='ownershipOptions'><![CDATA[1]]></param></params>";Bulk.regardingobjectid = new Lookup();

Bulk.regardingobjectid.type = "list";

Bulk.regardingobjectid.name = "a";

Bulk.regardingobjectid.Value = new Guid("55fc34ef-94bf-dd11-b4c1-005056aa0942");

Bulk.subject = "newBulk";

Bulk.targetedrecordtypecode = new Picklist();

Bulk.targetedrecordtypecode.name="Cliente - Candidato";

Bulk.targetedrecordtypecode.Value = 1;

_crmsrv.Create(Bulk);

 Thanks!

All Replies
  • Hi,

    Even I am getting the same error. Have you got any solution for that?

     

    Thanks,

    Krutika S.

  • try that:

     

    /* Método que genera la campaña express en funcióna a la lista de marketing:
    * Parámetros:
    * LM_List : lista de marketing
    * Tipo de Actividad a Asociar: "phonecall", "fax", "email", "letter", "appointment" * */
    public void expressCampaignGenerator(list LM_List, string activityType )
    {
    CreateActivitiesListRequest add = new CreateActivitiesListRequest();
    //si la actividad es una llamada telefónica
    if(activityType.ToLower().Trim().Equals("phonecall"))
    { add.Activity = this.createPhonecall(LM_List.listname); }
    //si la actividad es un email
    if(activityType.ToLower().Trim().Equals("email"))
    { add.Activity = this.createEmail(LM_List.listname); }
    //si la actividad es un fax
    if(activityType.ToLower().Trim().Equals("fax"))
    { add.Activity = this.createFax(LM_List.listname); }
    //si la actividad es una carta
    if(activityType.ToLower().Trim().Equals("letter"))
    { add.Activity = this.createLetter(LM_List.listname); }
    //si la actividad es una cita
    if(activityType.ToLower().Trim().Equals("appointment"))
    { add.Activity = this.createAppointment(LM_List.listname); }
    //relaciona a la lista de actividades con la lista de marketing

    add.FriendlyName = LM_List.listname;
    add.ListId = LM_List.listid.Value;
    //asigna a la lista de actividades la propiedad de propagarse
    add.Propagate = true;
    add.OwnershipOptions = PropagationOwnershipOptions.ListMemberOwner;
    CreateActivitiesListResponse added=(CreateActivitiesListResponse)
    crmsrv.Execute(add);
    }