Last updated: Aug 29 2016

Marketo connector API methods

The following methods let a developer perform operations on email templates and folders.


public int CreateTemplate(string name, string content, int folderId, string description = "");
public bool DeleteTemplate(int id);
public EmailTemplate GetTemplateById(int id);
public EmailTemplate GetTemplateByName(string name);
public string GetTemplateContentById(int id);
public IEnumerable<EmailTemplate> GetTemplates(int maxReturn = 0);
public bool UpdateTemplate(int id, string name = "", string description = "");
public bool UpdateTemplateContentById(int id, string content);


public Folder GetFolderByName(string name);
public IEnumerable<Folder> GetFolders(int rootFolderId, int maxReturn = 0, int maxDepth = 0);


Sample code

The following code shows how to use the IEmailTemplateServer and IFolderService methods.

using EPiServer.MarketingAutomationIntegration.Domain;
using EPiServer.MarketingAutomationIntegration.Marketo.Services;
	EmailTemplateService emailTempService = new EmailTemplateService();
	FolderService folderService = new FolderService();

	// Get a folder by name
	var folder = folderService.GetFolderByName("Sample folder");

	// Get all folders
	var folders = folderService.GetFolders(15, 25);
	// Create a new email template
	string content = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "/SampleTemplate.html");
	emailTempService.CreateTemplate("TestTemplate1", content, folder.Id, "Test Description");

	// Get template by id
	var template = emailTempService.GetTemplateById(1009);

	// Get template by name
	var templateByName = emailTempService.GetTemplateByName("TestTemplate1");

	// Update Template
	var isUpdated = emailTempService.UpdateTemplate(1009, "Updated Name", "Updated Description");

	// Get template content (html of the email) by Id
	var emailContent = emailTempService.GetTemplateContentById(1009);

	// Update template content (html of the email) by Id
	var updateSuccess = emailTempService.UpdateTemplateContentById(1009, "Updated Content");

	// Get all templates
	var allTemplates = emailTempService.GetTemplates();

	// Delete a template
	var delete = emailTempService.DeleteTemplate(1009);