Click or drag to resize

IEmailTranslations Property

Return the email message translations.

Namespace:  AskiaPortalCmn
Assembly:  AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax
IEmailTranslations Translations { get; }

Return Value

Type: IEmailTranslations
Returns the email message translations.
Examples

Translate an email in different languages

var context = ContextFactory.CreateByUserGuid(Guid.Parse("20BE5F84-F006-49A0-9674-4B16A090AF2D"));   
var contextValidation = context.Validate();
if (!contextValidation.Success)
{
    throw contextValidation.Exception;
}
var email = EmailFactory.FindById(context, 2);
if (email == null)
{
    Console.WriteLine("The specified email doesn't exist, or the current user within the context could not access it");
    return;
}
const int english = 1;
const int french = 2;
var englishMessage = email.Translations.FindOrCreate(english);
englishMessage.Subject = "Hello";
englishMEssage.Body = "Hello world!";
var frenchMessage = email.Translations.FindOrCreate(french);
frenchMessage.Subject = "Salut";
frenchMessage.Body = "Salut tout le monde!";

var saveResult = email.Save();
if (!saveResult.Success)
{
    Console.Error.WriteLine(saveResult.Exception.Message);
}
Console.WriteLine("The email successfully translated");
See Also