FMX.AddressBook.Types.TContactEmails.AddEmail
Delphi
function AddEmail(const AKind: TContactEmail.TLabelKind; const AEmail: string): TContactEmail; overload;
function AddEmail(const ALabel: string; const AEmail: string): TContactEmail; overload;
C++
TContactEmail* __fastcall AddEmail(const TContactEmail::TLabelKind AKind, const System::UnicodeString AEmail)/* overload */;
TContactEmail* __fastcall AddEmail(const System::UnicodeString ALabel, const System::UnicodeString AEmail)/* overload */;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | FMX.AddressBook.Types.pas FMX.AddressBook.Types.hpp |
FMX.AddressBook.Types | TContactEmails |
Description
Adds a new email address to a list of the contact email adresses.
Use this method to add a new email address to a list of the contact email addresses. The input parameters of this method allows you to specify the following characteristics:
AEmail
: specifies the contact mail, such as John.Doe@mycompany.com'.AKind
: in the first overloaded method, this parameter specifies the kind of the contact mail.Alabel
: in the second overloaded method, this parameter specifies an optional text label, such as "Home," " Office," and like.
Examples
To clarify, consider the following examples. These code snippets illustrate how to specify the contact work email address, and save this contact to Address Book.
Delphi:
var
Contact: TAddressBookContact;
eMails: TContactEmails;
begin
Contact := AddressBook1.CreateContact(AddressBook1.DefaultSource);
try
// Add the work mail
eMails := TContactEmails.Create;
try
eMails.AddEmail(TContactEmail.TLabelKind.Work, 'John.Doe@mycompany.com');
Contact.eMails := eMails;
finally
eMails.Free;
end;
AddressBook1.SaveContact(Contact);
finally
Contact.Free;
end;
end;
C++Builder:
TAddressBookContact *Contact;
TContactEmails *eMails;
// Create a new contact
Contact = AddressBook1->CreateContact(AddressBook1->DefaultSource());
__try {
// Add the work mail to the newly created contact
eMails = new TContactEmails();
__try {
eMails->AddEmail(TContactEmail::TLabelKind::Work,
"John.Doe@mycompany.com");
Contact->EMails = eMails;
}
__finally {
eMails->Free();
}
// Save contact to Address Book
AddressBook1->SaveContact(Contact);
}
__finally {
Contact->Free();
}
For more information and samples, see Mobile Tutorial: Using an Address Book Component (iOS and Android).