cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with EmailCampaign entity in C# API library

Member

Problem with EmailCampaign entity in C# API library

Here's the code I am running to add a contact list to a campaign:

 

                try
                {
                    EmailCampaign campaign = Utility.GetEmailCampaignById(authData, campaignId);

                    ContactList desiredList = this.GetDesiredList(listName);

                    campaign.ContactLists.Add(desiredList);

                    Utility.UpdateEmailCampaign(authData, campaign);
                }

The problem I'm running into is that the campaign object's EmailContentFormat is a null value. This proceeds to cause a problem when updating the email campaign on line 460 of EmailCampaignComponent.cs:

 

data.AppendFormat("<EmailContent>{0}</EmailContent>", emailCampaign.EmailContentFormat.Equals("HTML")? emailCampaign.Content : emailCampaign.XContent);

Additionally, the Content and XContent properties are also null.

 

My initial assumption is that the entity is not properly setting that property value when the campaign is retrieved. If that's not the case, could you please let me know how to resolve this issue? We're kind of stuck at the moment.

 

Thanks.

 

Update: After some more research, I found that the email campaign response stream does not contain the content format or content nodes, which means the problem is the response.

2 REPLIES 2
CTCT Employee

Re: Problem with EmailCampaign entity in C# API library

Hey Cristina,

 

I will look into this issue for you but it sounds like there isnt any html or XHTML included for it to include.  Thus it is showing up null.  Are you supplying which information to be included into the email?

Ryan Davis
Quality Engineer
Member

Re: Problem with EmailCampaign entity in C# API library

The draft campaign I'm testing with definitely has rich HTML content, so I don't see why it wouldn't be included. I'd appreciate if you could check the campaign directly to see if there's something we're missing (username: HarmsSoftware, campaign: Test Campaign2).

 

Thanks.