Title: create a new Outlook contact item?
{
Dieser Tip arbeitet mit D5/D6 und mit Outlook 2000 oder Outlook 98
This Tip works with D5/D6, with Outlook 2000 or Outlook 98
}
{$IFDEF SYN_COMPILER_6}
uses
ComObj, Outlook2000;
{$ELSE}
uses
ComObj, Outlook8;
{$ENDIF}
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 := 'User';
Contact.FirstName := 'Jack';
Contact.HomeAddressStreet := 'Street';
Contact.HomeAddressCountry := 'Germany';
Contact.HomeAddressPostalCode := '12345';
Contact.HomeAddressCity := 'City';
Contact.HomeTelephoneNumber := '+49(0)1239/23903';
Contact.HomeFaxNumber := '+49(0)1239/23904';
Contact.Email1Address := 'info@user.com';
Contact.Save;
OutlApp := nil;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
NewContactItem;
end;