> Thanks, I'm nearly there.
> With your bit of code and some messing around I can get the Inbox email
> addresses perfectly. I then copied the code onto another button to get
the
> deleted items addresses. The code below is the same bt for the name of
the
> folder.
> Te only problem here is that there are 1131 deleted items and if I track
the
> i variable as below it stops at 546 thus halting the program completely.
> There are quiet a few that don't have a return address for some reason but
> I skip them.
> FYI - there is an Outlook App server object from the D5 tab on the form.
> Any more thoughts would be grateful.
> Andy
> Code:
> ------------
> procedure TLoadTableForm.Button1Click(Sender: TObject);
> var
> i, j, k: Integer;
> EmailAddress: string;
> NmSpace: NameSpace;
> Folder: MAPIFolder;
> Mapi, Contacts,CI : OleVariant;
> Personal, MyFolder, PostVak: OleVariant;
> MailItem2,MyItem: OleVariant;
> begin
> AdsContacts.Exclusive := true;
> AdsContacts.oPEN;
> AdsContacts.AdsZapTable; // file://uses advantage database engine
> MyFolder := 'Deleted Items';
> OutlookApplication1.Connect;
> MAPI := OutlookApplication1.GetNamespace('MAPI');
> Personal := Mapi.Folders(Mapi.Folders(1).Name ) ;
> PostVak := Personal.Folders( MyFolder );
> showmessage(IntToStr(PostVak.Items.Count)); // shows 1131
> for i := 1 to PostVak.Items.Count do
> begin
> try
> Application.ProcessMessages;
> Edit1.Text := IntToStr(i); // stops at 546
> MyItem := PostVak.Items(i);
> MailItem2 := MyItem.Reply;
> EmailAddress := MailItem2.Recipients.Item(1).Address;
> if EmailAddress <> '' then
> begin
> AdsContacts.Insert;
> AdsContacts.FieldByName('Email').AsString := EmailAddress;
> AdsContacts.Post;
> end;
> except
> end;
> end;
> showmessage('Complete');
> end;
> "Deborah Pate (TeamB)" <d.p...@cableinet.co.not-this-bit.uk> wrote in
> message news:VA.000008ae.002ce0a9@cableinet.co.not-this-bit.uk...
> > <<Andy Dyble:
> > FieldByName('EmailAddress').AsString :=
> > CurrentContact.SenderName;
> > You can get the email address of the sender by createing a
> > temporary reply to the message:
> > var
> > MI, Reply: MailItem;
> > begin
> > MI := Inbox.Items.Item(Inbox.Items.Count) as MailItem;
> > Reply := MI.Reply;
> > Caption := Reply.Recipients.Item(1).Address;
> > --
> > Deborah Pate (TeamB) http://delphi-jedi.org
> > Use Borland servers; TeamB don't see posts via ISPs
> > http://www.borland.com/newsgroups/genl_faqs.html