My client has been successfully creating and scheduling Email Send Definitions via the SOAP API in what they call the standard version. Now they are Enterprise customers so I have been working to ensure the process that is already working continues to work. So far most of the changes have been to add the ClientID to the subscriber list, the email and the Send Definition since they now have multiple Business Units. Everything is working except when it comes time to schedule the Email Send Definition, then I get an Error Code 2
The Status Message is:
"Exception occurred during [ScheduleEmailSendDefinition] ErrorID: 1459951015"
The code I am using to create the Email Send Definition is this:
ClientID clientID = new ClientID();
clientID.ID = account_id;
clientID.IDSpecified = true;
String requestId = null;
String overallStatus = null;
//Define the EmailSendDefinition EmailSendDefinition
sendDef = new EmailSendDefinition();
sendDef.Name = "Test";
sendDef.CustomerKey = "Test";
sendDef.Description = "Used for automation";
sendDef.CategoryID = 819712;
sendDef.CategoryIDSpecified = true;
sendDef.Client = clientID;
//Specify Email
ExactTargetClient.Email email = new ExactTargetClient.Email();
email.ID = emailID; //ID from validated email
email.IDSpecified = true;
email.Client = clientID;
//Specify SendClassification
SendClassification sc = new SendClassification();
sc.CustomerKey = "Default Commercial";
//Commercial
classification sc.Client = clientID;
//Specify the SendDefinitionList
SendDefinitionList[] defList = new SendDefinitionList[1];
defList[0] = new SendDefinitionList();
defList[0].SendDefinitionListTypeSpecified = true;
defList[0].SendDefinitionListType = SendDefinitionListTypeEnum.SourceList;
defList[0].DataSourceTypeID = DataSourceTypeEnum.List;
defList[0].DataSourceTypeIDSpecified = true;
List list = new List();
list.ID = listID;
list.IDSpecified = true;
list.Client = clientID;
defList[0].List = list;
defList[0].Client = clientID;
SenderProfile profile = new SenderProfile();
profile.CustomerKey = "Default";
profile.Client = clientID;
sendDef.SenderProfile = profile;
//Associate the email, the sendclassification, and SendDefinitionList
sendDef.Email = email;
sendDef.SendClassification = sc;
sendDef.SendDefinitionList = defList;
CreateResult[] results = etFramework.Create(new CreateOptions(), new APIObject[] { sendDef } , out requestId, out overallStatus);
And then the code to schedule the Email Send Definition:
String pRequestId = null;
String pOverAllStatus = null;
String statusMessage = null;
ClientID clientID = new ClientID();
clientID.ID = account_id;
clientID.IDSpecified = true;
ScheduleDefinition sd = new ScheduleDefinition();
sd.Occurrences = 1;
sd.OccurrencesSpecified = true;
DateTime time = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, scheduledTime.Hour, scheduledTime.Minute, 0, DateTimeKind.Local);
sd.StartDateTime = time;
sd.StartDateTimeSpecified = true;
sd.Client = clientID;
//sendDef was created above
sendDef.CustomerKey = "Test";
sendDef.Client = clientID;
ScheduleResult[] perfResults = etFramework.Schedule(new ScheduleOptions(), "start", sd, new APIObject[] { sendDef }, out pOverAllStatus, out statusMessage, out pRequestId);