public class ETEmail extends ETSoapObject
An ETEmail represents an email in the
Salesforce Marketing Cloud. Emails are managed in the
Marketing Cloud Email app under the "Content" menu:
Via the SDK, you can create, retrieve, update, and delete emails.
To create an email:
ETClient client = new ETClient();
ETEmail email = new ETEmail();
email.setKey("myemail");
email.setName("my email");
email.setSubject("This is my first email");
email.setHtmlBody("<b>This is the HTML body</b>");
email.setTextBody("This is the text body");
ETResponse<ETEmail> response = client.create(email);
for (ETResult<ETEmail> result : response.getResults()) {
System.out.println(result);
}
To retrieve an email:
ETClient client = new ETClient();
ETResponse<ETEmail> response = client.retrieve(ETEmail.class, "key=myemail");
for (ETResult<ETEmail> result : response.getResults()) {
System.out.println(result);
}
To retrieve all emails:
ETClient client = new ETClient();
ETResponse<ETEmail> response = client.retrieve(ETEmail.class);
for (ETResult<ETEmail> result : response.getResults()) {
System.out.println(result);
}
To update an email:
ETClient client = new ETClient();
ETEmail email = client.retrieveObject(ETEmail.class, "key=myemail");
email.setSubject("This is still my first email");
ETResponse<ETEmail> response = client.update(email);
for (ETResult<ETEmail> result : response.getResults()) {
System.out.println(result);
}
To delete an email:
ETClient client = new ETClient();
ETResponse<ETEmail> response = client.delete(ETEmail.class, "key=myemail");
for (ETResult<ETEmail> result : response.getResults()) {
System.out.println(result);
}
Note: You can (and should) reuse ETClient instances,
as instantiating an instance involves authenticating with the
Salesforce Marketing Cloud and is, thus, a heavyweight operation.
| Modifier and Type | Class and Description |
|---|---|
static class |
ETEmail.Type
Email Types that can be used
|
ETSoapObject.DataExtensionRowConverter, ETSoapObject.EnumConverter, ETSoapObject.ExternalObjectConverter, ETSoapObject.InternalObjectConverterPAGE_SIZE| Constructor and Description |
|---|
ETEmail()
Class constructor, Initializes a new instance of the class.
|
| Modifier and Type | Method and Description |
|---|---|
Integer |
getCategoryId()
Deprecated.
Use
getFolderId(). |
Date |
getCreatedDate() |
String |
getCustomerKey()
Deprecated.
Use
getKey(). |
Integer |
getFolderId() |
String |
getHtmlBody() |
String |
getId() |
Boolean |
getIsHtmlPaste() |
String |
getKey() |
Date |
getModifiedDate() |
String |
getName() |
String |
getSubject() |
String |
getTextBody() |
ETEmail.Type |
getType() |
void |
setCategoryId(Integer categoryId)
Deprecated.
Use
setFolderId(). |
void |
setCreatedDate(Date createdDate) |
void |
setCustomerKey(String customerKey)
Deprecated.
Use
setKey(). |
void |
setFolderId(Integer folderId) |
void |
setHtmlBody(String htmlBody) |
void |
setId(String id) |
void |
setIsHtmlPaste(Boolean isHtmlPaste) |
void |
setKey(String key) |
void |
setModifiedDate(Date modifiedDate) |
void |
setName(String name) |
void |
setSubject(String subject) |
void |
setTextBody(String textBody) |
void |
setType(ETEmail.Type type) |
create, delete, delete, fromInternal, getInternalProperties, getInternalProperty, retrieve, retrieve, retrieve, retrieve, toFilterPart, toInternal, updategetAllModified, getModified, setModifiedgetAllFields, getAllFields, getClient, getField, getField, setClient, toStringpublic ETEmail()
public String getId()
getId in class ETApiObjectpublic void setId(String id)
setId in class ETApiObjectid - The Identifier of the ETEmail object.public String getKey()
public void setKey(String key)
key - The Customer Key of the ETEmail object.public String getName()
public void setName(String name)
name - The name of the ETEmail object.public Date getCreatedDate()
public void setCreatedDate(Date createdDate)
createdDate - The created date of the ETEmail object.public Date getModifiedDate()
public void setModifiedDate(Date modifiedDate)
modifiedDate - The modified date of the ETEmail object.public Integer getFolderId()
public void setFolderId(Integer folderId)
folderId - The folder Id(category Id) of the ETEmail object.public String getSubject()
public void setSubject(String subject)
subject - The subject of the ETEmail object.public String getHtmlBody()
public void setHtmlBody(String htmlBody)
htmlBody - The HTML body of the ETEmail object.public String getTextBody()
public void setTextBody(String textBody)
textBody - The text body of the ETEmail object.public Boolean getIsHtmlPaste()
public void setIsHtmlPaste(Boolean isHtmlPaste)
isHtmlPaste - Sets if it is HTML paste or not.public ETEmail.Type getType()
ETEmail.Typepublic void setType(ETEmail.Type type)
type - The type of the ETEmail object.ETEmail.Type@Deprecated public String getCustomerKey()
getKey().@Deprecated public void setCustomerKey(String customerKey)
setKey().@Deprecated public Integer getCategoryId()
getFolderId().@Deprecated public void setCategoryId(Integer categoryId)
setFolderId().Copyright © 2017. All rights reserved.