SilverPop Integration


SilverPop is a third party emailing tool which is not only provide the facility to prepare the email templates which needs to be used in sending an email as well as it provides the support for campaign management through various things.

Introduction


This article focuses on how to integrate SilverPop Engage 4 in .NET.
SilverPop is a third party emailing tool which is not only provide the facility to prepare the email templates which needs to be
used in sending an email as well as it provides the support for campaign management through various things.
By using SilverPop Engage we can send an email on scheduling basis like hourly,daily,weekly,monthly etc.
SilverPop Transact provides the facility to send an email for some triggerring mechanism like user registered successfully,etc.

Figure – Transact Mailing Process

Figure – Roles and Responsibilities Graphic

Background


As we know there are various email providers available in market like MailChimp,Campaign Monitor,Constant
Contact,iContact,AWeber,etc.
SilverPop is like the other products as well with some additional features.

How to setup SilverPop


There are few documents which help us to configure the SilverPop for our needs.
This document contains all the information of how to setup the SilverPop to function as an emailing tool and by following the
steps we can easily shoot an email or create emailing template for our need.
In short this document describes SilverPop's emailing process in detail.

Using the code


The one thing the documents doesn't describe is how to integrate the tool in our application?.NET application? which is
required to send an email by using code.
If any user uses SilverPop for fulfilling their emailing needs then here is the way to integrate the same in application.
For integrating the SilverPop we need to add the reference of http://api4.silverpop.com/SoapApi?wsdl
There are various API's for using the SilverPop, some useful APIs are mentioned as follows:
1.Session Management Interfaces
These interfaces are useful in authenticating with the tool.
User Login
Login API used for authenticating with Silverpop.
Before calling any other interface we need to get authenticated first by using Login interface.
If Silverpop successfully authenticated the request with the provided credentials then it will return SUCCESS=true and
SESSIONID which will be used for making call to Silverpop's interface(s).

private string Login(string userName, string password)
{
if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password))
{
throw new Exception("User name or password is null or empty.");
}
else
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
LoginRequestType loginRequest = new LoginRequestType();
SessionMgmtResponseType sessionMgmtResponse = new SessionMgmtResponseType();
loginRequest.USERNAME = userName;
loginRequest.PASSWORD = password;
sessionMgmtResponse = engage.Login(loginRequest);
if (sessionMgmtResponse.SUCCESS)
return sessionMgmtResponse.SESSIONID;
else
return null;
}
}


User Logout
Logout API used for closing the established session with Silverpop.
As the name is self explanatory, this interface does the work of logging out the user from the Silverpop, closing and invalidate
the session established.
If Silverpop successfully logs out the user then it will return SUCCESS=true.


private bool Logout(string sessionId)
{
if (string.IsNullOrEmpty(sessionId))
{
throw new Exception("Provided session id is null or empty.");
}
else
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
sessionheadertype sessionHeader = new sessionheadertype();
LogoutRequestType logoutRequest = new LogoutRequestType();
SessionMgmtResponseType sessionMgmtResponse = new SessionMgmtResponseType();
sessionHeader.sessionid = sessionId;
sessionMgmtResponse = engage.Logout(sessionHeader, logoutRequest);
return sessionMgmtResponse.SUCCESS;
}
}


2.Database Management Interfaces-USER

Add a Contact
As the name is self explanatory, this interface used to add new contact to an existing database.
For adding the recipient we need to provide the ID of of the database to which we are adding a contact along with the values
of the fields which uniquely identifies the row in that database.
There are various elements used along with this API as follows:
LIST_ID : The ID of the database to which you are adding the contact.
CREATED_FROM : Value indicating the way in which you are adding the contact to the system. Values include:
0 – Imported from a database
1 – Added manually
2 – Opted in
3 – Created from tracking database
UPDATE_IF_FOUND : If the UPDATE_IF_FOUND element is set to true, attempting to add a contact with a duplicate key will
result in an update to their record
COLUMN : XML nodes defining the column name and value for fields being added or updated.
SEND_AUTOREPLY : If the database has an autoresponder associated with it and the SEND_AUTOREPLY element is set to true,
Engage sends the confirmation when the contact is added to the database.


private string AddRecipient(string sessionId, long listId)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
AddRecipientRequestType addRecipientRequest = new AddRecipientRequestType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
ListMgmtResponseType listMgmtResponse = new ListMgmtResponseType();
addRecipientRequest.LIST_ID = listId;
addRecipientRequest.CREATED_FROM = 2;
addRecipientRequest.UPDATE_IF_FOUND = true;
addRecipientRequest.COLUMN = new ColumnElementType[]
{
new ColumnElementType { NAME = "UserID", VALUE = "101" },
new ColumnElementType { NAME = "UserName", VALUE = "abc" }
};
addRecipientRequest.SEND_AUTOREPLY = true;
listMgmtResponse = engage.AddRecipient(sessionHeader, addRecipientRequest);
if (listMgmtResponse.SUCCESS)
return listMgmtResponse.RecipientId;
else
throw new Exception("Unable to add recipient");
}


Add a Column to a database
AddListColumn API is used to add new column to an existing database.
There are various elements used along with this API as follows:
LIST_ID : The ID of the Engage database the column is being added to.
COLUMN_NAME : The name of the column being added.
COLUMN_TYPE : Defines what type of column to create. The following is a list of valid values :
0 – Text column
1 – YES/No column
2 – Numeric column
3 – Date column
4 – Time column
5 – Country column
6 – Select one
8 – Segmenting
13 – SMS Opt In
14 – SMS Opted Out Date
15 – SMS Phone Number
16 – Phone Number
17 – Timestamp
20 – Multi-Select

private bool AddListColumn(string sessionId, long listId, string columnName)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
AddListColumnRequestType addListColumnRequest = new AddListColumnRequestType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
ListMgmtUserActionsResponseType listMgmtUserActionResponse = new
ListMgmtUserActionsResponseType();
addListColumnRequest.LIST_ID = listId;
addListColumnRequest.COLUMN_NAME = columnName;
addListColumnRequest.COLUMN_TYPE = 0;
listMgmtUserActionResponse = engage.AddListColumn(sessionHeader, addListColumnRequest);
return listMgmtUserActionResponse.SUCCESS;
}


Get a list of databases
GetLists API is used to extraxts a list of databases.
There are various elements used along with this API as follows:
VISIBILITY : Defines the visibility of the databases to return.
0 – Private
1 – Shared
LIST_TYPE : Defines the type of entity to return. Supported values are:
0 – Databases
1 – Queries
2 – Databases, Contact Lists and Queries
5 – Test Lists
6 – Seed Lists
13 – Suppression Lists
15 – Relational Tables
18 – Contact Lists

private void GetLists(string sessionId, int visibility, int listType)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
GetListsRequestType getList = new GetListsRequestType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
ListMgmtUserActionsResponseType listMgmtUserActionsResponse = new
ListMgmtUserActionsResponseType();
getList.VISIBILITY = visibility;
getList.LIST_TYPE = listType;
listMgmtUserActionsResponse = engage.GetLists(sessionHeader, getList);
if (listMgmtUserActionsResponse.SUCCESS)
{
// We need to fetch the respective details as per our need
}
else
{
throw new Exception("Failed to get the list details.");
}
}


Add a Contact to a Contact list
AddContactToContactList API is used to add new contact to contact list.
There are various elements used along with this API as follows:
CONTACT_LIST_ID : The ID of the Contact List to which you are adding the contact.
CONTACT_ID : The ID of the contact being added to the Contact List.
COLUMN : Required if the database has a key other than Email or no Unique Identifier and Contact Id is not provided.


private bool AddContactToContactList(string sessionId, long contactListId, long contactId, string
columnName, string columnValue)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
AddContactToContactListRequestType addContactToContactList = new
AddContactToContactListRequestType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
ListMgmtUserActionsResponseType listMgmtUserActionsResponse = new
ListMgmtUserActionsResponseType();
addContactToContactList.CONTACT_LIST_ID = contactListId;
addContactToContactList.CONTACT_ID = contactId;
addContactToContactList.COLUMN = new ColumnNameValueElementType[]
{
new ColumnNameValueElementType() { NAME = columnName, VALUE =
columnValue }
};
listMgmtUserActionsResponse = engage.AddContactToContactList(sessionHeader,
addContactToContactList);
return listMgmtUserActionsResponse.SUCCESS;
}


Export from a database
ExportList API is used for exports contact data from a database, query, or contact list.
There are various elements used along with this API as follows:
LIST_ID : Unique identifier for the database, query, or contact list Engage is exporting.
EXPORT_TYPE : Specifies which contacts to export. Valid values are:
ALL – export entire database.
OPT_IN – export only currently opted-in contacts.
OPT_OUT – export only currently opted-out contacts.
UNDELIVERABLE – export only contacts who are currently marked as undeliverable.
EXPORT_FORMAT : Specifies the format ?file type? for the exported data. Valid values are:
CSV – create a comma-separated values file
TAB – create a tab-separated values file
PIPE – create a pipe-separated values file
DATE_START : Specifies the beginning boundary of information to export.
DATE_END : Specifies the ending boundary of information to export.


private void ExportList(string sessionId, long listId, DateTime startDate, DateTime endDate)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
ExportListRequestType exportList = new ExportListRequestType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
ListMgmtUserActionsResponseType listMgmtUserActionsResponse = new
ListMgmtUserActionsResponseType();
exportList.LIST_ID = listId;
exportList.EXPORT_TYPE = ExportType.ALL;
exportList.EXPORT_FORMAT = ListTableExportFormat.CSV;
exportList.ADD_TO_STORED_FILES = "Private/Stored Files/ExportFiles";
exportList.DATE_START = startDate.ToString();
exportList.DATE_END = endDate.ToString();
listMgmtUserActionsResponse = engage.ExportList(sessionHeader, exportList);
if (listMgmtUserActionsResponse.SUCCESS)
{
GetJobStatusRequestType getJobStatus = new GetJobStatusRequestType();
ReportingResponseType reportingResponse = new ReportingResponseType();
getJobStatus.JOB_ID = listMgmtUserActionsResponse.JOB_ID;
again:
reportingResponse = engage.GetJobStatus(sessionHeader, getJobStatus);
if
(reportingResponse.JOB_STATUS.ToString().ToLower().Equals(JobStatus.COMPLETE.ToString().ToLower()))
{
//exported successfully
}
else if
(reportingResponse.JOB_STATUS.ToString().ToLower().Equals(JobStatus.ERROR.ToString().ToLower()))
{
//export with errors
}
else
{
goto again;
}
}
}


Get database details
GetListMetaData API is used to fetch the details about the database, list or query.
There are various elements used along with this API as follows:
LIST_ID : Numeric identifier for the entity Engage is exporting.

private void GetListMetaData(string sessionId, long listId)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
GetListMetaDataRequestType getListMetaData = new GetListMetaDataRequestType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
ListMgmtUserActionsResponseType listMgmtUserActionsResponse = new
ListMgmtUserActionsResponseType();
getListMetaData.LIST_ID = listId;
listMgmtUserActionsResponse = engage.GetListMetaData(sessionHeader, getListMetaData);
if (listMgmtUserActionsResponse.SUCCESS)
{
// Success
}
else
{
throw new Exception("Unable to fetch list meta data.");
}
}


Select contact details
SelectRecipientData API is used retrieve the information about a contact from a database.
There are various elements used along with this API as follows:
LIST_ID : ID of the database to which the contact belongs.
EMAIL : The contact email address to look up.

private string SelectRecipientData(string sessionId, long listId, string emailAddress)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
SelectRecipientRequestType selectRecipientData = new SelectRecipientRequestType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
ListMgmtResponseType listMgmtResponse = new ListMgmtResponseType();
selectRecipientData.LIST_ID = listId;
selectRecipientData.EMAIL = emailAddress;
listMgmtResponse = engage.SelectRecipientData(sessionHeader, selectRecipientData);
if (listMgmtResponse.SUCCESS)
{
// here we have returning only recipient id but we can also have other details like
LastModified,OptedIn,etc.
return listMgmtResponse.RecipientId;
}
else
{
throw new Exception("Unable to fetch the recipient's data.");
}
}


List contact mailings
ListRecipientMailings API is used to fetch the recipients mailings.
There are various elements used along with this API as follows:
LIST_ID : Unique ID of the database or query whose mailings you are requesting.
RECIPIENT_ID : Unique ID of the contact for whom to look up mailings.

private void ListRecipientMailings(string sessionId, long listId, long recipientId)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
ListRecipientMailingsRequestType listRecipientMailings = new
ListRecipientMailingsRequestType();
ListMgmtUserActionsResponseType listMgmtUserActionsResponse = new
ListMgmtUserActionsResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
listRecipientMailings.LIST_ID = listId;
listRecipientMailings.RECIPIENT_ID = recipientId;
listMgmtUserActionsResponse = engage.ListRecipientMailings(sessionHeader,
listRecipientMailings);
if (listMgmtUserActionsResponse.SUCCESS)
{
//Here we have all the details about the mailings for the specified recipient.
}
else
{
throw new Exception("Unable to fetch the recipients mailings.");
}
}


Remove a contact
RemoveRecipient API is used to remove a contact from a database or contact list.
There are various elements used along with this API as follows:
LIST_ID : Unique ID of the database or Contact List from which to remove contact.
EMAIL : Email address of the contact to remove.

private bool RemoveRecipient(string sessionId, long listId, string emailAddress)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
RemoveRecipientRequestType removeRecipient = new RemoveRecipientRequestType();
ListMgmtUserActionsResponseType listMgmtUserActionsResponse = new
ListMgmtUserActionsResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
removeRecipient.LIST_ID = listId;
removeRecipient.EMAIL = emailAddress;
listMgmtUserActionsResponse = engage.RemoveRecipient(sessionHeader, removeRecipient);
return listMgmtUserActionsResponse.SUCCESS;
}


Create a contact list
CreateContactList API is used to create a new contact list.
There are various elements used along with this API as follows:

DATABASE_ID : The Id of the database the new Contact List will be associated with.
CONTACT_LIST_NAME : The name of the Contact List to be created.
VISIBILITY : Defines the visibility of the Contact List being created.
0 – Private
1 – Shared

private long CreateContactList(string sessionId, long databaseId, string contactListName,
int visibility)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
CreateContactListRequestType createContactList = new CreateContactListRequestType();
ListMgmtUserActionsResponseType listMgmtUserActionsResponse = new
ListMgmtUserActionsResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
createContactList.DATABASE_ID = databaseId;
createContactList.CONTACT_LIST_NAME = contactListName;
createContactList.VISIBILITY = visibility;
listMgmtUserActionsResponse = engage.CreateContactList(sessionHeader,
createContactList);
if (listMgmtUserActionsResponse.SUCCESS)
{
return listMgmtUserActionsResponse.CONTACT_LIST_ID;
}
else
{
throw new Exception("Unable to create a contact list.");
}
}


Update a contact
UpdateRecipient API is used to update an existing contact in a database.
There are various elements used along with this API as follows:
LIST_ID : The ID of the database to which the contact resides in.
COLUMN : XML nodes defining the column name and value.

private bool UpdateRecipient(string sessionId, long listId, string columnName1, string
columnValue1, string columnName2, string columnValue2)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
UpdateRecipientRequestType update = new UpdateRecipientRequestType();
ListMgmtResponseType listMgmtResponse = new ListMgmtResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
update.LIST_ID = listId;
update.COLUMN = new ColumnElementType[]
{
new ColumnElementType(){ NAME=columnName1, VALUE=columnValue1 },
new ColumnElementType(){ NAME=columnName2, VALUE=columnValue2 }
};
listMgmtResponse = engage.UpdateRecipient(sessionHeader, update);
return listMgmtResponse.SUCCESS;
}


Opt-out a contact
OptOutRecipient API is used to move a contact in opted-out state.
There are various elements used along with this API as follows:
LIST_ID : Identifies the ID of the database from which to opt out the contact.
EMAIL : The contact email address to opt out.

private bool OptOutRecipient(string sessionId, long listId, string emailAddress)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
OptOutRecipientRequestType optOutRecipient = new OptOutRecipientRequestType();
ListMgmtResponseType listMgmtResponse = new ListMgmtResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
optOutRecipient.LIST_ID = listId;
optOutRecipient.EMAIL = emailAddress;
listMgmtResponse = engage.OptOutRecipient(sessionHeader, optOutRecipient);
return listMgmtResponse.SUCCESS;
}


Create a Relational Table
CreateTable API is used to create a relational table.
There are various elements used along with this API as follows:
TABLE_NAME : Defines the name of the new table.
COLUMNS : XML nodes defining the table columns you are inserting/updating.

private long CreateTable(string sessionId, string tableName)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
CreateTableRequestType createTable = new CreateTableRequestType();
ListMgmtUserActionsResponseType listMgmtUserActionsResponse = new
ListMgmtUserActionsResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
createTable.TABLE_NAME = tableName;
createTable.COLUMNS = new TableColumnElementType[]
{
new TableColumnElementType{ NAME = "ID",TYPE
=TableColumnType.TEXT,KEY_COLUMN=true,KEY_COLUMNSpecified=true},
new TableColumnElementType{ NAME = "UserID",TYPE
=TableColumnType.NUMERIC},
new TableColumnElementType{ NAME ="UserName",TYPE =
TableColumnType.TEXT},
new TableColumnElementType{ NAME = "Address", TYPE =
TableColumnType.TEXT}
};
listMgmtUserActionsResponse = engage.CreateTable(sessionHeader, createTable);
if (listMgmtUserActionsResponse.SUCCESS)
{
return listMgmtUserActionsResponse.TABLE_ID;
}
else
{
throw new Exception("Unable to create table.");
}
}


Delete a Relational Table
DeleteTable API is used to delete a relational table.
There are various elements used along with this API as follows:
TABLE_NAME : Specify the folder path and name of the Relational Table you are deleting.
TABLE_VISIBILITY : Defining the visibility of the table you are referencing. Required if not specified in TABLE_NAME.
0 – Private
1 – Shared
EMAIL : Engage sends notification to the provided email address when the job is complete.

private bool DeleteTable(string sessionId, string tableName, int visibility, string
emailAddress)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
DeleteTableRequestType deletetable = new DeleteTableRequestType();
ListMgmtUserActionsResponseType listMgmtUserActionsResponse = new
ListMgmtUserActionsResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
deletetable.TABLE_NAME = tableName;
deletetable.TABLE_VISIBILITY = visibility;
deletetable.EMAIL = emailAddress;
listMgmtUserActionsResponse = engage.DeleteTable(sessionHeader, deletetable);
GetJobStatusRequestType getJobStatus = new GetJobStatusRequestType();
ReportingResponseType reportingResponse = new ReportingResponseType();
getJobStatus.JOB_ID = listMgmtUserActionsResponse.JOB_ID;
again:
reportingResponse = engage.GetJobStatus(sessionHeader, getJobStatus);
if
(reportingResponse.JOB_STATUS.ToString().ToLower().Equals(JobStatus.COMPLETE.ToString().ToLower()))
{
//print successfully deleted the table
return true;
}
else
{
goto again;
}
}


Insert and update records in a Relational Table
InsertUpdateRelationalTable API is used to insert/update relational table data.
There are various elements used along with this API as follows:
TABLE_ID : The Id of the Engage Table that will be updated.
ROWS : XML node containing ROW elements for each row being inserted or updated.

private bool InsertUpdateRelationalTable(string sessionId, long tableId, string columnName1,
string columnValue1, string columnName2, string columnValue2)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
InsertUpdateRelationalTableRequestType insertUpdateRelationalTableRequest = new
InsertUpdateRelationalTableRequestType();
ListMgmtUserActionsResponseType listMgmtUserActionResponse = new
ListMgmtUserActionsResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
insertUpdateRelationalTableRequest.TABLE_ID = tableId;
insertUpdateRelationalTableRequest.ROWS = new RowColumnElementType[][]
{
new RowColumnElementType[]
{
new RowColumnElementType{name=
columnName1, Value= columnValue1},
new RowColumnElementType{name=
columnName2, Value= columnValue2}
}
};
listMgmtUserActionResponse = engage.InsertUpdateRelationalTable(sessionHeader,
insertUpdateRelationalTableRequest);
return listMgmtUserActionResponse.SUCCESS;
}


Export from a Relational Table
ExportTable API is used export relational table data into CSV file.
There are various elements used along with this API as follows:
TABLE_NAME : Specify the folder path and name of the Relational Table you are deleting.
TABLE_VISIBILITY : Defining the visibility of the table you are referencing. Required if not specified in TABLE_NAME.
0 – Private
1 – Shared
TABLE_VISIBILITYSpecified : Identifiies whether table visibility is specified or not.
EXPORT_FORMAT : Specifies the file format for the exported data. Valid values are:
CSV – create a comma-separated values file
TAB – create a tab-separated values file
PIPE – create a pipe-separated values file
DATE_START : Specifies the beginning boundary of information to export.
DATE_END : Specifies the ending boundary of information to export.

private string ExportTable(string sessionId, string tableName, int visibility, DateTime
startDate, DateTime endDate)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
ExportTableRequestType exportTableRequest = new ExportTableRequestType();
ListMgmtUserActionsResponseType listMgmtUserActionsResponse = new
ListMgmtUserActionsResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
exportTableRequest.TABLE_NAME = tableName;
exportTableRequest.TABLE_VISIBILITY = visibility;
exportTableRequest.TABLE_VISIBILITYSpecified = true;
exportTableRequest.EXPORT_FORMAT = ListTableExportFormat.CSV;
exportTableRequest.DATE_START = startDate.ToString();
exportTableRequest.DATE_END = endDate.ToString();
listMgmtUserActionsResponse = engage.ExportTable(sessionHeader, exportTableRequest);
GetJobStatusRequestType getJobStatusRequest = new GetJobStatusRequestType();
ReportingResponseType reportingResponse = new ReportingResponseType();
if (listMgmtUserActionsResponse.SUCCESS)
{
getJobStatusRequest.JOB_ID = listMgmtUserActionsResponse.JOB_ID;
again:
reportingResponse = engage.GetJobStatus(sessionHeader, getJobStatusRequest);
if
(reportingResponse.JOB_STATUS.ToString().ToLower().Equals(JobStatus.COMPLETE.ToString().ToLower()))
{
//print exported successfully
return listMgmtUserActionsResponse.FILE_PATH;
}
else if
(reportingResponse.JOB_STATUS.ToString().ToLower().Equals(JobStatus.ERROR.ToString().ToLower()))
{
//export with errors
throw new Exception("Unable to export table");
}
else
goto again;
}
else
{
throw new Exception("Unable to export table");
}
}


Purge data from a Relational Table
PurgeTable API is used to delete relational table data.
There are various elements used along with this API as follows:
TABLE_NAME : Specify the folder path and name of the Relational Table you are deleting.
TABLE_ID : The Id of the Engage Table you are deleting.
TABLE_IDSpecified : Identifiies whether table id is specified or not.
TABLE_VISIBILITY : Defining the visibility of the table you are referencing. Required if not specified in TABLE_NAME.
0 – Private
1 – Shared
TABLE_VISIBILITYSpecified : Identifiies whether table visibility is specified or not.
DELETE_BEFORE : Only data last modified before the specified date/time will be purged.
EMAIL : Engage sends notification to the provided email address when the job is complete.

private bool PurgeTable(string sessionId, string tableName, long tableId, int visibility,
DateTime deleteBefore, string emailAddress)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
PurgeTableRequestType purgeTable = new PurgeTableRequestType();
ListMgmtUserActionsResponseType listMgmtUserActionsResponse = new
ListMgmtUserActionsResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
purgeTable.TABLE_NAME = tableName;
purgeTable.TABLE_ID = tableId;
purgeTable.TABLE_IDSpecified = true;
purgeTable.TABLE_VISIBILITY = visibility;
purgeTable.TABLE_VISIBILITYSpecified = true;
purgeTable.DELETE_BEFORE = deleteBefore.ToString();
purgeTable.EMAIL = emailAddress;
listMgmtUserActionsResponse = engage.PurgeTable(sessionHeader, purgeTable);
if (listMgmtUserActionsResponse.SUCCESS)
{
GetJobStatusRequestType getJobStatus = new GetJobStatusRequestType();
ReportingResponseType reportingResponse = new ReportingResponseType();
getJobStatus.JOB_ID = listMgmtUserActionsResponse.JOB_ID;
again:
reportingResponse = engage.GetJobStatus(sessionHeader, getJobStatus);
if
(reportingResponse.JOB_STATUS.ToString().ToLower().Equals(JobStatus.COMPLETE.ToString().ToLower()))
{
//Successfully purge the data from the said table
return true;
}
else if
(reportingResponse.JOB_STATUS.ToString().ToLower().Equals(JobStatus.ERROR.ToString().ToLower()))
{
//purge with errors
return false;
}
else
goto again;
}
else
{
throw new Exception("Unable to purge the data.");
}
}


Calculate the current contacts for a query
CalculateQuery API is used to calculate a query size.
There are various elements used along with this API as follows:
QUERY_ID : ID of the Query to be calculated.
EMAIL : Engage sends notification to the provided email address when the job is complete.

private bool CalculateQuery(string sessionId, long queryId, string emailAddress)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
CalculateQueryRequestType calculateQueryRequest = new CalculateQueryRequestType();
ListMgmtUserActionsResponseType listMgmtUserActionsResponse = new
ListMgmtUserActionsResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
calculateQueryRequest.QUERY_ID = queryId;
calculateQueryRequest.EMAIL = emailAddress;
listMgmtUserActionsResponse = engage.CalculateQuery(sessionHeader,
calculateQueryRequest);
if (listMgmtUserActionsResponse.SUCCESS)
{
GetJobStatusRequestType getJobRequest = new GetJobStatusRequestType();
ReportingResponseType reportingResponse = new ReportingResponseType();
getJobRequest.JOB_ID = listMgmtUserActionsResponse.JOB_ID;
again:
reportingResponse = engage.GetJobStatus(sessionHeader, getJobRequest);
if
(reportingResponse.JOB_STATUS.ToString().ToLower().Equals(JobStatus.COMPLETE.ToString().ToLower()))
{
//calculated successfully
return true;
}
else if
(reportingResponse.JOB_STATUS.ToString().ToLower().Equals(JobStatus.ERROR.ToString().ToLower()))
{
//calculated with errors
throw new Exception("Unable to calculate query.");
}
else
goto again;
}
else
return false;
}


Delete records from a Relational Table
DeleteRelationalTableData API is used to delete records from a table.
There are various elements used along with this API as follows:
TABLE_ID : The Id of the Engage Table that will be updated.
ROWS : XML node containing ROW elements for each row being deleted.

private bool DeleteRelationalTableData(string sessionId, long tableId, string keyColumnName,
string keyColumnValue)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
DeleteRelationalTableDataRequestType deleteRelationalTableDataRequest = new
DeleteRelationalTableDataRequestType();
ListMgmtUserActionsResponseType listMgmtUserActionsResponse = new
ListMgmtUserActionsResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
deleteRelationalTableDataRequest.TABLE_ID = tableId;
deleteRelationalTableDataRequest.ROWS = new ColumnNameElementType[][]
{
new ColumnNameElementType[]
{
new ColumnNameElementType{
name=keyColumnName, Value=keyColumnValue}
}
};
listMgmtUserActionsResponse = engage.DeleteRelationalTableData(sessionHeader,
deleteRelationalTableDataRequest);
return listMgmtUserActionsResponse.SUCCESS;
}


Associate Relational Data with Contacts in a Database
JoinTable API is used to associate a database with a relational table.
There are various elements used along with this API as follows:
TABLE_NAME : Specify the folder path and name of the Relational Table you are deleting.
TABLE_VISIBILITY : Defining the visibility of the table you are referencing. Required if not specified in TABLE_NAME.
0 – Private
1 – Shared
TABLE_VISIBILITYSpecified : Identifiies whether table visibility is specified or not.
LIST_NAME : Specifying the folder path and name of the database you are associating.
LIST_VISIBILITY : Defining the visibility of the database you are referencing. Required if not specified in LIST_NAME.
0 – Private
1 – Shared
LIST_VISIBILITYSpecified : Identifiies whether list visibility is specified or not.

private bool JoinTable(string sessionId, string tableName, int visibility, string listName,
int listVisibility, string listField, string tableField)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
JoinTableRequestType joinTableRequest = new JoinTableRequestType();
ListMgmtUserActionsResponseType listMgmtUserActionsResponse = new
ListMgmtUserActionsResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
joinTableRequest.TABLE_NAME = tableName;
joinTableRequest.TABLE_VISIBILITY = visibility;
joinTableRequest.TABLE_VISIBILITYSpecified = true;
joinTableRequest.LIST_NAME = listName;
joinTableRequest.LIST_VISIBILITY = listVisibility;
joinTableRequest.LIST_VISIBILITYSpecified = true;
joinTableRequest.MAP_FIELD = new MapFieldElementType[]
{
new MapFieldElementType{ LIST_FIELD=listField,
TABLE_FIELD=tableField}
};
listMgmtUserActionsResponse = engage.JoinTable(sessionHeader, joinTableRequest);
if (listMgmtUserActionsResponse.SUCCESS)
{
GetJobStatusRequestType getJobStatusRequest = new GetJobStatusRequestType();
ReportingResponseType reportingResponse = new ReportingResponseType();
getJobStatusRequest.JOB_ID = listMgmtUserActionsResponse.JOB_ID;
again:
reportingResponse = engage.GetJobStatus(sessionHeader, getJobStatusRequest);
if
(reportingResponse.JOB_STATUS.ToString().ToLower().Equals(JobStatus.COMPLETE.ToString().ToLower()))
{
//successfully joined the tables
return true;
}
else if
(reportingResponse.JOB_STATUS.ToString().ToLower().Equals(JobStatus.ERROR.ToString().ToLower()))
{
//joined the tables with errors
throw new Exception("Unable to join tables.");
}
else
goto again;
}
else
return false;
}


Add a Contact to a Program
AddContactToProgram API is used to add a contact to a program.
There are various elements used along with this API as follows:
PROGRAM_ID : Unique ID of the program.
CONTACT_ID : Unique ID of the contact being added to the program.

private bool AddContactToProgram(string sessionId, long programId, long contactId)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
AddContactToProgramRequestType addContactToProgram = new
AddContactToProgramRequestType();
ListMgmtUserActionsResponseType listMgmtUserActionsResponse = new
ListMgmtUserActionsResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
addContactToProgram.PROGRAM_ID = programId;
addContactToProgram.CONTACT_ID = contactId;
listMgmtUserActionsResponse = engage.AddContactToProgram(sessionHeader,
addContactToProgram);
return listMgmtUserActionsResponse.SUCCESS;
}


3.Reporting Interfaces - USER
Get a list of sent mailings for a user
The GetSentMailingsForUser API is used extract a list of mailings sent for the user for a specific date range.
There are various elements used along with this API as follows:
DATE_START : Required Starting Date in the format "mm/dd/yyyy hh:mm:ss"
DATE_END : Required Ending Date in the format "mm/dd/yyyy hh:mm:ss"

private void GetSentMailingsForUser(string sessionId, DateTime startdate, DateTime endDate)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
GetSentMailingsForUserRequestType getSentMailingsForUser = new
GetSentMailingsForUserRequestType();
ReportingResponseType reportingResponse = new ReportingResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
getSentMailingsForUser.DATE_START = startdate.ToString();
getSentMailingsForUser.DATE_END = endDate.ToString();
reportingResponse = engage.GetSentMailingsForUser(sessionHeader,
getSentMailingsForUser);
if (reportingResponse.SUCCESS)
{
// Here we have all the details about the mailings for the specified user.
}
else
{
throw new Exception("Unable to fetch sent mailings for user.");
}
}


Delete a Data Job
The DeleteJob API is used to remove the job from Engage.
There are various elements used along with this API as follows:
JOB_ID : Identifies the Background Job to remove from Engage.

private bool DeleteJob(string sessionId, long jobId)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
DeleteJobRequestType deleteJob = new DeleteJobRequestType();
ReportingResponseType reportingResponse = new ReportingResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
deleteJob.JOB_ID = jobId;
reportingResponse = engage.DeleteJob(sessionHeader, deleteJob);
return reportingResponse.SUCCESS;
}


Get a list of sent mailings for a Database

GetSentMailingsForList API is used to fetch the send mailings for a particular database for specified date range.
There are various elements used along with this API as follows:
DATE_START : Required Starting Date in the format "mm/dd/yyyy hh:mm:ss"
DATE_END : Required Ending Date in the format "mm/dd/yyyy hh:mm:ss"
LIST_ID : Required ID of the Database or Query for which to retrieve mailings.

private void GetSentMailingsForList(string sessionId, DateTime startDate, DateTime endDate,
long listId)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
GetSentMailingsForListRequestType getSentMailingsForList = new
GetSentMailingsForListRequestType();
ReportingResponseType reportingResponse = new ReportingResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
getSentMailingsForList.DATE_START = startDate.ToString();
getSentMailingsForList.DATE_END = endDate.ToString();
getSentMailingsForList.LIST_ID = listId;
reportingResponse = engage.GetSentMailingsForList(sessionHeader,
getSentMailingsForList);
if (reportingResponse.SUCCESS)
{
// Here we have all the details about the mailings for the specified user.
}
else
{
throw new Exception("Unable to fetch the sent mailing list.");
}
}


Get a list of sent mailings for an Org
GetSentMailingsForOrg API is used to fetch the sent mailings for an organization for specified date range.
There are various elements used along with this API as follows:
DATE_START : Required Starting Date in the format "mm/dd/yyyy hh:mm:ss"
DATE_END : Required Ending Date in the format "mm/dd/yyyy hh:mm:ss"

private void GetSentMailingsForOrg(string sessionId, DateTime startDate, DateTime endDate)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
GetSentMailingsForOrgRequestType getSentMailingsForOrg = new
GetSentMailingsForOrgRequestType();
ReportingResponseType reportingResponse = new ReportingResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
getSentMailingsForOrg.DATE_START = startDate.ToString();
getSentMailingsForOrg.DATE_END = endDate.ToString();
reportingResponse = engage.GetSentMailingsForOrg(sessionHeader, getSentMailingsForOrg);
if (reportingResponse.SUCCESS)
{
// Here we have all the details about the mailings for the specified organization.
}
else
{
throw new Exception("Unable to fetch the send mailings for organization for
specified date range.");
}
}

Get a list of Report Ids for a mailing
GetReportIdByDate API is used to fetch the report ids for provided mailing id for specified date range.
There are various elements used along with this API as follows:
MAILING_ID : ID of the mailing for which to export metrics. The account used to log on to the current session must own this
mailing.
DATE_START : Specifies the beginning boundary of information to receive. If time is included, it must be in 24-hour format.
DATE_END : Specifies the ending boundary of information to receive. If time is included, it must be in 24-hour format.

private void GetReportIdByDate(string sessionId, long mailingId, DateTime startDate,
DateTime endDate)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
GetReportIdByDateRequestType getReportIdByDateRequest = new
GetReportIdByDateRequestType();
ReportingResponseType reportingResponse = new ReportingResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
getReportIdByDateRequest.MAILING_ID = mailingId;
getReportIdByDateRequest.DATE_START = startDate.ToString();
getReportIdByDateRequest.DATE_END = endDate.ToString();
reportingResponse = engage.GetReportIdByDate(sessionHeader, getReportIdByDateRequest);
if (reportingResponse.SUCCESS)
{
}
else
{
throw new Exception("Unable to fetch the report ids for provided mailing id for
specified date range.");
}
}


Export raw contact events
RawRecipientDataExport API is used export unique contact-level events and creates a .zip file containing a single flat file with all
metrics.
There are various elements used along with this API as follows:
EVENT_DATE_START : Specifies the beginning boundary of activity for information to receive.
EVENT_DATE_END : Specifies the ending boundary of activity for information to receive.
EXPORT_FORMAT : Defines the formatting of the source file. Supported values are:
0 – CSV file?default?
1 – Pipe-separated file
2 – Tab-separated file
EMAIL : If specified, the provided email address receives notification when the job is complete.
COLUMNS : XML node used to request list columns to export for each contact.

private void RawRecipientDataExport(string sessionId, DateTime eventStartDate, DateTime
eventEndDate, int exportFormat, string emailAddress, string exportColumn1, string exportColumn2)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
RawRecipientDataExportRequestType rawRecipientDataExportRequest = new
RawRecipientDataExportRequestType();
ReportingResponseType reportingResponse = new ReportingResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
rawRecipientDataExportRequest.EVENT_DATE_START = eventStartDate.ToString();
rawRecipientDataExportRequest.EVENT_DATE_END = eventEndDate.ToString();
rawRecipientDataExportRequest.EXPORT_FORMAT = exportFormat;
rawRecipientDataExportRequest.EMAIL = emailAddress;
rawRecipientDataExportRequest.COLUMNS = new ColumnElementType1[]
{
new ColumnElementType1{ NAME = exportColumn1
},
new ColumnElementType1{ NAME = exportColumn2
}
};
reportingResponse = engage.RawRecipientDataExport(sessionHeader,
rawRecipientDataExportRequest);
if (reportingResponse.SUCCESS)
{
GetJobStatusRequestType getJobStatus = new GetJobStatusRequestType();
ReportingResponseType reportingResponse1 = new ReportingResponseType();
getJobStatus.JOB_ID = reportingResponse.MAILING.JOB_ID;
again:
reportingResponse1 = engage.GetJobStatus(sessionHeader, getJobStatus);
if
(reportingResponse1.JOB_STATUS.ToString().ToLower().Equals(JobStatus.COMPLETE.ToString().ToLower()))
{
// Success
}
else if
(reportingResponse1.JOB_STATUS.ToString().ToLower().Equals(JobStatus.ERROR.ToString().ToLower()))
{
// with errors
}
else
goto again;
}
}

4.Mailing management interfaces
Send a mailing to a contact
SendMailing API is used to automate a send mailing to user on particular event.
There are various elements used along with this API as follows:
MailingId : Identifies the mailing Engage will send.
RecipientEmail : Identifies the targeted contact's email address.

private bool SendMailing(long mailingId, string recipientEmailAddress)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
SendMailingRequestType sendMailingRequest = new SendMailingRequestType();
SendMailingResponseType sendMailingResponse = new SendMailingResponseType();
sendMailingRequest.MailingId = mailingId;
sendMailingRequest.RecipientEmail = recipientEmailAddress;
sendMailingResponse = engage.SendMailing(sendMailingRequest);
return sendMailingResponse.SUCCESS;
}

Get a list of mailing templates
GetMailingTemplates API is used extracts a list of shared or private mailings.
There are various elements used along with this API as follows:
VISIBILITY : Defines the visibility of the mailing templates to return.
0 – Private
1 – Shared
LAST_MODIFIED_START_DATE : Start Date used to filter mailing templates by the date and time the mailing template was last
modified.
LAST_MODIFIED_END_DATE : End Date used to filter mailing templates by the date and time the mailing template was last
modified.

private void GetMailingTemplates(string sessionId, DateTime lastModifiedStartDate, DateTime
lastModifiedEndDate, int visibility)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
GetMailingTemplatesRequestType getMailingTemplates = new
GetMailingTemplatesRequestType();
MailMgmtUserActionsResponseType mailMgmtUserActionsResponse = new
MailMgmtUserActionsResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
getMailingTemplates.LAST_MODIFIED_START_DATE = lastModifiedStartDate.ToString();
getMailingTemplates.LAST_MODIFIED_END_DATE = lastModifiedEndDate.ToString();
getMailingTemplates.VISIBILITY = visibility;
mailMgmtUserActionsResponse = engage.GetMailingTemplates(sessionHeader,
getMailingTemplates);
if (mailMgmtUserActionsResponse.SUCCESS)
{
}
else
{
throw new Exception("Unable to fetch mailing templates");
}
}

Preview a mailing before sending
PreviewMailing API is used to view a preview of mailing.
There are various elements used along with this API as follows:
MailingId : Numeric identifier for the mailing template to be exported.

private string PreviewMailing(string sessionId, long mailingId)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
PreviewMailingRequestType previewMailing = new PreviewMailingRequestType();
MailMgmtUserActionsResponseType mailMgmtUserActionsResponse = new
MailMgmtUserActionsResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
previewMailing.MailingId = mailingId;
mailMgmtUserActionsResponse = engage.PreviewMailing(sessionHeader, previewMailing);
if (mailMgmtUserActionsResponse.SUCCESS)
{
return mailMgmtUserActionsResponse.HTMLBody;
}
else
{
throw new Exception("Unable to preview mailing.");
}
}

Schedule a mailing
ScheduleMailing API is used schedule a mailing.
There are various elements used along with this API as follows:
TEMPLATE_ID : ID of template upon which to base the mailing.
LIST_ID : ID of database, query, or contact list to send the template-based mailing.
MAILING_NAME : Name to assign to the generated mailing.
SEND_HTML : If this element is present, value is true. Leave blank if you do not want to include the HTML body.
SEND_AOL : If this element is present, value is true. Leave blank if you do not want to include the AOL body.
SEND_TEXT : If this element is present, value is true. Leave blank if you do not want to include the text body.
SUBJECT : Subject of the mailing.
FROM_NAME : From name of the mailing.
FROM_ADDRESS : From address of the mailing.
REPLY_TO : Reply to address.
VISIBILITY : Value indicating where to save the sent mailing. Values are:
0 – Private Folder
1 – Shared Folder
SCHEDULED : Value specifying the date and time when the mailing will be scheduled to send. The format must be:
MM/DD/YYYY HH:MM:SS AMPM
If this element is not included, the mailing will be sent immediately.

private long ScheduleMailing(string sessionId, long templateId, long listId, string
mailingName, string subject, string fromName, string fromAddress, string replyTo, int visibility)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
ScheduleMailingRequestType scheduleMailingRequest = new ScheduleMailingRequestType();
MailMgmtUserActionsResponseType scheduleMailingResponse = new
MailMgmtUserActionsResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
scheduleMailingRequest.TEMPLATE_ID = templateId;
scheduleMailingRequest.LIST_ID = listId;
scheduleMailingRequest.MAILING_NAME = mailingName;
scheduleMailingRequest.SEND_HTML = true.ToString();
scheduleMailingRequest.SEND_AOL = true.ToString();
scheduleMailingRequest.SEND_TEXT = true.ToString();
scheduleMailingRequest.SUBJECT = subject;
scheduleMailingRequest.FROM_NAME = fromName;
scheduleMailingRequest.FROM_ADDRESS = fromAddress;
scheduleMailingRequest.REPLY_TO = replyTo;
scheduleMailingRequest.VISIBILITY = visibility;
scheduleMailingRequest.SCHEDULED = DateTime.Now.AddSeconds(1).ToString();
scheduleMailingResponse = engage.ScheduleMailing(sessionHeader, scheduleMailingRequest);
if (scheduleMailingResponse.SUCCESS)
{
return scheduleMailingResponse.MAILING_ID;
}
else
{
throw new Exception("Unable to schedule mailing.");
}
}

Export a mailing template
ExportMailingTemplate API is used to export mailing template.
There are various elements used along with this API as follows:
TEMPLATE_ID : Numeric identifier for the mailing template to be exported.
ADD_TO_STORED_FILES : Use the ADD_TO_STORED_FILES parameter to write the output to the stored files folder within
Engage.

private string ExportMailingTemplate(string sessionId, long templateId)
{
EngageSoapApiClientService_InterfaceClient engage = new
EngageSoapApiClientService_InterfaceClient();
ExportMailingTemplateRequestType exportMailingTemplateRequest = new
ExportMailingTemplateRequestType();
MailMgmtUserActionsResponseType mailMgmtUserActionsResponse = new
MailMgmtUserActionsResponseType();
sessionheadertype sessionHeader = new sessionheadertype();
sessionHeader.sessionid = sessionId;
exportMailingTemplateRequest.TEMPLATE_ID = templateId;
exportMailingTemplateRequest.ADD_TO_STORED_FILES = string.Empty;
mailMgmtUserActionsResponse = engage.ExportMailingTemplate(sessionHeader,
exportMailingTemplateRequest);
if (mailMgmtUserActionsResponse.SUCCESS)
{
return mailMgmtUserActionsResponse.FILE_PATH;
}
else
{
throw new Exception("Unable to export mailing template.");
}
}

References


I am not smart enough to write this article on my own hence the references:
Silverpop Transact XML Evaluation Guide


Related Articles

More articles: Email C# 4.0 .net

Comments

Author: sridhar thota11 Sep 2016 Member Level: Gold   Points : 0

Hi Rajan Patekar.

Good article, nice work. Keep posting.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: