1

I am using the FuelSDK for Csharp and have hit a snag when attempting to PostReturn an EmailSendDefinition. the error:

There was an error generating the XML document.

and if you dig further in, you see the inner exception providing a bit more light:

The type FuelSDK.ET_List was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.

my code:

        int sendEmailId = 111111
        int toListId = 111111;
        ET_EmailSendDefinition sendReq = new ET_EmailSendDefinition();
        sendReq.AuthStub = myclient;
        sendReq.Name = "testsend1";
        sendReq.CustomerKey = "testsend1";
        sendReq.Description = "testing a send to subscribers of the list";
        sendReq.SendClassification = new ET_SendClassification() { CustomerKey = "xxx" }; 
        sendReq.SendDefinitionList = new ET_SendDefinitionList[] { 
        new ET_SendDefinitionList() { List = new ET_List() { ID = toListId }, 
        DataSourceTypeID = DataSourceTypeEnum.List } };
        sendReq.Email = new ET_Email() { ID = sendEmailId };
        PostReturn postESD = sendReq.Post();

Another post on this site deals exactly with this issue, with a solution of changing the List = new ET_List to List = new FuelSDK.ET_List. This doesn't work for me. I have also tried various flavors of XmlSerialization declarations on the ET_List object in ET_Client.cs, with no luck.

My implementation of this is the FuelSDK is a seperate project in my solution and i have referenced that project from a testing project (console app). i have not changed the namespace of FuelSDK.

Also, I have been able to successfully create a list and add subscribers to a list, so I am pretty sure the client object is functioning correctly.

any help is appreciated!

0

I was able to resolve this. Turns out that the "List" attribute of the ET_EmailSendDefinition.SendDefinitionList is actually an ET_AudienceItem object in the version of the SDK that I'm using. The samples provided with the SDK indicated that it is an ET_List object. Simply hovering over this attribute in the IDE revealed the problem. the corrected code:

        AudienceItem ai = new AudienceItem();
        ai.List = new List { ID = toListId };
        sendReq.SendDefinitionList = new ET_SendDefinitionList[] { new ET_SendDefinitionList() { List = ai.List, DataSourceTypeID = DataSourceTypeEnum.List } };

hopefully, this will save someone down the road some time!

thanks!

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.