0

How to retrieve an Exact Target Email?

I followed from the sample here:

and I have the below code:

var retrieveRequest = new RetrieveRequest();
        retrieveRequest.ObjectType = "Email";
        retrieveRequest.Properties = new []
                                         {
                                             "ID","Name"
                                         };

        // add the filter
        var simpleFilterPart = new SimpleFilterPart
                                   {
                                       SimpleOperator = SimpleOperators.equals,
                                       Property = "Name",
                                       Value = new[] { "EmailTemplateTest1" },

                                   };

        retrieveRequest.Filter = simpleFilterPart;

        APIObject[] apiObjects;

        string requestId;
        var result = this._soapClient.Retrieve(retrieveRequest, out requestId, out apiObjects);

But when it runs, the "result" variable contains the below error message:

**Error: Invalid column name 'Name'.
Invalid column name 'EmailTemplateTest1'.**

"Name" is a column name for my Email Template whose name is "EmailTemplateTest1".

Not sure what could be wrong? the column names and values look fine to me.

Should I be specifying the Folder path (e.g. Folder1/Folder2/Folder3) in which the email template is located? if so, how?

Any thought?

thanks

The Light
  • 26,341
  • 62
  • 176
  • 258

1 Answers1

2

I have been struggling with the ExactTarget soap api as well. The only way I have been able to retrieve an email is by setting :

retrievRequest.QueryAllAccounts = true

retrievRequest.QueryAllAccountsSpecified = true
eeerahul
  • 1,629
  • 4
  • 27
  • 38
kmurch
  • 36
  • 1
  • that was apparently one of the issues. I changed the filter to be based on ID rather than Name and it works (though it doesn't retrieve other properties such as HTMLBody, etc.). It's very hard to work with their API in general due to poor documentation and no proper error messages. – The Light Feb 22 '12 at 11:30