outlook'a kişi kaydetmek

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Cevapla
bgoktas
Kıdemli Üye
Mesajlar: 769
Kayıt: 27 Nis 2004 10:32
Konum: istanbul

outlook'a kişi kaydetmek

Mesaj gönderen bgoktas »

Selam arkadaşlar, outlook express 'e delphi ile nasıl kişi kaydedebilirim acaba?
bgoktas
Kıdemli Üye
Mesajlar: 769
Kayıt: 27 Nis 2004 10:32
Konum: istanbul

Re: outlook'a kişi kaydetmek

Mesaj gönderen bgoktas »

Kod: Tümünü seç

uses
  ComObj, Variants, SysUtils;

type
  TContact = record
    LastName: string;
    FirstName : string;
    Company : string;
    // ###  Further properties. See MSDN
  end;


  //------------------------------------------------------------------------------
{:Add outlook contact

@param ContactFolderPath The contact path. E.g.: '' for default contact folder,
  'SubFolder\Sub2\Test' for subfolders
@param Contact The contact informations.
@author 19.09.2003 Michael Klemm}
  //------------------------------------------------------------------------------
procedure OutlookAddContact(ContactFolderPath : string; Contact : TContact);
const
  olFolderContacts = $0000000A;
var
  Outlook : OleVariant;
  NameSpace : OleVariant;
  ContactsRoot : OleVariant;
  ContactsFolder : OleVariant;
  OutlookContact : OleVariant;
  SubFolderName : string;
  Position : integer;
  Found : boolean;
  Counter : integer;
  TestContactFolder : OleVariant;
begin
  // Connect to outlook
  Outlook := CreateOleObject('Outlook.Application');
  // Get name space
  NameSpace := Outlook.GetNameSpace('MAPI');
  // Get root contacts folder
  ContactsRoot := NameSpace.GetDefaultFolder(olFolderContacts);
  // Iterate to subfolder
  ContactsFolder := ContactsRoot;
  while ContactFolderPath <> '' do
  begin
    // Extract next subfolder
    Position := Pos('\', ContactFolderPath);
    if Position > 0 then
    begin
      SubFolderName := Copy(ContactFolderPath, 1, Position - 1);
      ContactFolderPath := Copy(ContactFolderPath, Position + 1, Length(ContactFolderPath));
    end
    else
    begin
      SubFolderName := ContactFolderPath;
      ContactFolderPath := '';
    end;
    if SubFolderName = '' then
      Break;
    // Search subfolder
    Found := False;
    for Counter := 1 to ContactsFolder.Folders.Count do
    begin
      TestContactFolder := ContactsRoot.Folders.Item(Counter);
      if LowerCase(TestContactFolder.Name) = LowerCase(SubFolderName) then
      begin
        ContactsFolder := TestContactFolder;
        Found := True;
        Break;
      end;
    end;
    // If not found create
    if not Found then
      ContactsFolder := ContactsFolder.Folders.Add(SubFolderName);
  end;
  // Create contact item
  OutlookContact := ContactsFolder.Items.Add;
  // Fill contact information
  OutlookContact.FirstName := Contact.FirstName;
  OutlookContact.LastName := Contact.LastName;
  OutlookContact.CompanyName := Contact.Company;

  // ### Further properties

  // Save contact
  OutlookContact.Save;
  // Disconnect from outlook
  Outlook := Unassigned;
end;
şeklinde hallettim. kolay gelsin...
Kullanıcı avatarı
MehmetZahit
Üye
Mesajlar: 70
Kayıt: 04 Tem 2007 08:39

Re: outlook'a kişi kaydetmek

Mesaj gönderen MehmetZahit »

bu kodlar ofis2003 ve Win98 üstü sistemlerde çalışıyor mu? Güvenlikler arttırılınca outlook kontrolleri işlemez olmuştu.
bgoktas
Kıdemli Üye
Mesajlar: 769
Kayıt: 27 Nis 2004 10:32
Konum: istanbul

Re: outlook'a kişi kaydetmek

Mesaj gönderen bgoktas »

xp ve microsoft office xp tr outlook ile çalıştı hiç bir sorunda çıkartmadı
Cevapla