private APIObject[] RetrieveSendClassification() { ET_SendClassification scGetAll = new ET_SendClassification(); scGetAll.AuthStub = _etClient; scGetAll.Props = new string[] { "CustomerKey", "Name" }; GetReturn grAllSC = scGetAll.Get(); return(grAllSC.Results); }
public string CreateTriggeredSendDefinition(string name, string customerKey, string description, string subject, string htmlBody) { try { DeleteSendClassification(customerKey); string emailCustomerKey = CreateEmail(name, customerKey, description, subject, htmlBody); //var sp = RetrieveSendProfile(); //var dp = RetrieveDeliveryProfile(); ET_SendClassification sendClassification = new ET_SendClassification(); sendClassification.Name = name; sendClassification.CustomerKey = customerKey; sendClassification.SendClassificationType = SendClassificationTypeEnum.Marketing; sendClassification.SendClassificationTypeSpecified = true; sendClassification.SenderProfile = new ET_SenderProfile() { CustomerKey = "Default" }; sendClassification.DeliveryProfile = new ET_DeliveryProfile() { CustomerKey = "Default" }; sendClassification.AuthStub = _etClient; PostReturn status = sendClassification.Post(); string sendDefinitionCustomerKey = Guid.NewGuid().ToString(); FuelSDK.ET_TriggeredSend postEmailSendDef = new FuelSDK.ET_TriggeredSend(); postEmailSendDef.AuthStub = _etClient; postEmailSendDef.Name = name; postEmailSendDef.CustomerKey = sendDefinitionCustomerKey; postEmailSendDef.Description = description; postEmailSendDef.SendClassification = (SendClassification)sendClassification; // new ET_SendClassification() { CustomerKey = sendClassification.CustomerKey }; postEmailSendDef.TriggeredSendStatus = TriggeredSendStatusEnum.Active; FuelSDK.ET_Email email = new FuelSDK.ET_Email(); email.Name = name; email.AuthStub = _etClient; email.CustomerKey = emailCustomerKey; postEmailSendDef.Email = email; PostReturn postResponse = postEmailSendDef.Post(); if (postResponse.Status) { return(sendDefinitionCustomerKey); } else { return(string.Empty); } //return // new PostReturnStatus() // { // Status = postResponse.Status.ToString(), // Message = postResponse.Message.ToString(), // Code = postResponse.Code.ToString(), // ResultsLength = postResponse.Results.Length //}; } catch (Exception ex) { throw; } }