locked
Distribute Campaign Activity Programmatically... RRS feed

  • Question

  • Hi All,

    I would like to Distribute Campaing Activity Programmatically, but i am getting error(server was unable to process) so could u please try to resolve this issue, below that code:InitCrmService();

     

    CrmSdk.

    DistributeCampaignActivityRequest req = new CrmSdk.DistributeCampaignActivityRequest();

    req.CampaignActivityId = (

    Guid)comboBox2.SelectedValue;

    req.SendEmail =

    true;

    req.TemplateId = _templateId;

    req.Propagate =

    true;

    req.Activity =

    new DistributeCampaign.CrmSdk.email();

    req.Owner =

    new DistributeCampaign.CrmSdk.Moniker();

    CrmSdk.

    DistributeCampaignActivityResponse res = new CrmSdk.DistributeCampaignActivityResponse();

    res = (CrmSdk.

    DistributeCampaignActivityResponse)_service.Execute(req);

    Wednesday, May 5, 2010 2:35 PM

Answers

  • From what  role  are you  trying  to distribute  teh  activity?  did u set  the owner  of  the  activities  correctlY?(means a valid  user with apporpriate permission)?

    req.Owner = new DistributeCampaign.CrmSdk.Moniker();

    req.Owner.Id  = new Guid("GUid of owner  here");

    req.Owner.Name = EntityName.systemuser.ToString();


    Muhammad Ali Khan
    My MS CRM blog
    Thursday, May 6, 2010 10:08 AM

All replies

  • I don't know how many times I gave this answer... :)

    Put your code in the follwoing try catch block:

    try
    {
    // Your code
    }
    catch(SoapException error)
    {
    throw new Exception(error.Detail.SelectSingleNode("//description").InnerText);
    }
    That should give you a more understandable error message
    My blog : http://mscrmtools.blogspot.com

    All my tools on my new dedicated site: MSCRMTools Repository
    Wednesday, May 5, 2010 2:43 PM
    Moderator
  • The error message is: 0x80040216 An unexpected error occurred. Platform

    What does it indicates?

     

    -Thanks

     

     

    Wednesday, May 5, 2010 3:03 PM
  • i  think  you didn't  specify the  owner

    req.Owner = new DistributeCampaign.CrmSdk.Moniker();

    req.Owner.Id  = new Guid("GUid of owner  here");

    req.Owner.Name = EntityName.systemuser.ToString();

    or

    req.OwnerShipOptions  = PropagationOwnershipOptions.Caller;

     


    Muhammad Ali Khan
    My MS CRM blog
    Wednesday, May 5, 2010 3:17 PM
  • Yeah I have included this code and it works...

    req.Owner = new DistributeCampaign.CrmSdk.Moniker();

    req.Owner.Name = EntityName.systemuser.ToString();

    req.OwnerShipOptions  = PropagationOwnershipOptions.Caller;

     

    But when I was trying for the second time it is throwing the following exception:

    "This campaign activity has been distributed already. Campaign activities cannot be distributed more than one time."

     

    Can't we distribute a campaign activity for the second time? If so, how can we check whether it is distributed or not.

     

    -Thanks

    Wednesday, May 5, 2010 3:30 PM
  • Hi All,

    Its getting Distributed in windows application while go for CRM(webclient), The CampaignActivity is not getting Distribute, but the CampaingActivity (INProgress) Mode,

    -Thanks

     

    Wednesday, May 5, 2010 4:25 PM
  • Hi.

    No the same campaign activity cannot  be distributed again.  you have to create a  new campaign activity to distribute it again.

    What  you mean in  progress?


    Muhammad Ali Khan
    My MS CRM blog
    Wednesday, May 5, 2010 4:59 PM
  • Thanks for your suggestions.

    I checked in crm and the campaign activity is getting distributed into emails but they are listed in the Failures and the Reason is

    "You do not have enough privileges to access the Microsoft Dynamics CRM object or perform the requested operation. For more information, contact your Microsoft Dynamics CRM administrator."

    What might be the reason for this?

     

    -Thanks

    Thursday, May 6, 2010 7:53 AM
  • From what  role  are you  trying  to distribute  teh  activity?  did u set  the owner  of  the  activities  correctlY?(means a valid  user with apporpriate permission)?

    req.Owner = new DistributeCampaign.CrmSdk.Moniker();

    req.Owner.Id  = new Guid("GUid of owner  here");

    req.Owner.Name = EntityName.systemuser.ToString();


    Muhammad Ali Khan
    My MS CRM blog
    Thursday, May 6, 2010 10:08 AM
  • Thanks for u r suggestions,

    This is the thing i was missing, Thanks alot now i am able to distribute Campaign Activity.

    -Thanks

     

     

     

    Thursday, May 6, 2010 12:56 PM