i can create data extensions using the code provided on exact target help section. But i can't figure out how to define the data retention length. Suppose i want the data to be cleared automatically after 24 hours (not deleting the data extension).

Please see the code below (sample code)

$newde = new ExactTarget_DataExtension();                   
$newde->Name = "New DE2";
$newde->CustomerKey = "New DE2";
$newde->IsSendable = true;
$newde->IsTestable = false;
$newde->SendableDataExtensionField = new ExactTarget_DataExtensionField();                           
$newde->SendableDataExtensionField->Name = 'EMAIL';
$newde->SendableSubscriberField = new ExactTarget_Attribute();
$newde->SendableSubscriberField->Name = 'Email Address';

$newde->Fields = array();                           
$emailfield = new ExactTarget_DataExtensionField();
$emailfield->Name = 'EMAIL';
$emailfield->IsPrimaryKey = true;
$emailfield->IsRequired = true;
$emailfield->FieldType = ExactTarget_DataExtensionFieldType::EmailAddress;
$newde->Fields[] = $emailfield;

$fnamefield = new ExactTarget_DataExtensionField();
$fnamefield->Name = 'First Name';
$fnamefield->IsPrimaryKey = false;
$fnamefield->FieldType = ExactTarget_DataExtensionFieldType::Text;
$newde->Fields[] = $fnamefield;

$lnamefield = new ExactTarget_DataExtensionField();
$lnamefield->Name = 'Last Name';
$lnamefield->IsPrimaryKey = false;
$lnamefield->FieldType = ExactTarget_DataExtensionFieldType::Text;
$newde->Fields[] = $lnamefield;                                                             

$object = new SoapVar($newde, SOAP_ENC_OBJECT, 'DataExtension', "http://exacttarget.com/wsdl/partnerAPI");
$request = new ExactTarget_CreateRequest();
$request->Options = NULL;
$request->Objects = array($object);

$results = $client->Create($request);

Any help will be grateful.


  • Let me know if this answers your question. Feb 22, 2014 at 21:36

1 Answer 1


If you have this feature enabled, the data admin user for your ExactTarget account can enable or change the data retention policy for new data extensions. By default, the data extension retention policy deletes unused data extensions after 6 months. The deletion process runs nightly.

For more granular control over the data retention period, you may select the Use Object Based Retention checkbox to set the retention period, a fixed date on which the data rows or the data extension is deleted, and other options.

Based on the documentation here there are three properties you want to set - DataRetentionPeriod,DataRetentionPeriodLength, and DeleteAtEndOfRetentionPeriod.


Specifies the period during which the application retains the data within a data extension.


Specifies the number of time units for which data will be retained (used with DataRetentionPeriodUnitOfMeasure to specify the full data retention time).


Indicates whether data should be deleted at the end of the retention period.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .