Jak dodac nowy kontakt w książce adresowej Outlooka
tomaszos
{$IFDEF SYN_COMPILER_6}
uses
ComObj, Outlook2000;
{$ELSE}
uses
ComObj, Outlook8;
{$ENDIF}
procedure NewContactItem; //procedura dodania
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 := '[email protected]';
Contact.Save;
OutlApp := nil;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
// procedura wykorzystania
NewContactItem;
end;
Uwaga! To dziala pod Delphi 5/6 i Outlook'a 2000/98. Uwaga! Kod nie był testowany.
Kod pochodzi ze strony www.swissdelphicenter.ch.