[DELPHI] - Create New Outlook Contact
Code:
uses
ComObj, Outlook2000;
procedure NewContactItem;
var
OutlApp: OutlookApplication;
OutlNamespace: Namespace;
ContactFolder: MAPIFolder;
Contact: ContactItem;
begin
OutlApp:= CoOutlookApplication.Create;
OutlNamespace:= OutlApp.GetNameSpace('MAPI');
ContactFolder:= OutlNamespace.GetDefaultFolder(olFolderContacts);
Contact:= OutlApp.createitem(olContactItem) as ContactItem;
Contact.LastName := '';
Contact.FirstName:= '';
Contact.HomeAddressStreet:= '';
Contact.HomeAddressCountry:= '';
Contact.HomeAddressPostalCode:= '';
Contact.HomeAddressCity:= '';
Contact.HomeTelephoneNumber:= '';
Contact.HomeFaxNumber:= '';
Contact.Email1Address := '';
Contact.Save;
OutlApp:= nil;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
NewContactItem;
end;