Board index » delphi » Outlook 97, Inbox, SenderName not avail. to Delphii

Outlook 97, Inbox, SenderName not avail. to Delphii

Retrieveing messages from Outlook 97 via Delphi 3.0

Has anybody succeded in retrieving the
"SenderName" of a message in the inbox folder?

Calling the SenderName (From) property results in the following:

  ...raised an exception class EOleError with message
  'Method 'SenderName' not supported bu automation object'
  Process stopped Use Setp or Run to continue.

I should thought that SenderName was one of
the most important fields in the message.
Most other info (Body,Subject,EntryId,Size) is receved OK.

- Cut from my Delphi 3.0 program -------------------

procedure TForm1.TTY(Msg: string);
begin
  with Memo1.Lines do Add(Msg);
end;
.
 MyNameSpace := MyOutlook.GetNamespace('MAPI');
 MyPages:=      MyNameSpace.Logon('MyUser','MyPassword',false,true); // no
dialogue
 MyFolder :=    MyNameSpace.GetDefaultFolder(olFolderInbox);

 TTY('#-of msg in Folder: '+MyFolder.Name+'
('+IntToStr(MyFolder.Items.Count)+')');
 for i:=1 to MyFolder.Items.Count do begin
//   TTY('(SenderMame):'+MyFolder.Items(i).SenderName);
     TTY('(subject)   :'+MyFolder.Items(i).Subject);
     TTY('(body)      :'+MyFolder.Items(i).Body);
     TTY('(EntryId)   :'+MyFolder.Items(i).EntryId.SenderName);
     TTY('(Size)      :'+IntToStr(MyFolder.Items(i).Size)
 end;
.
.
- Cut end ----------------------------
Appreceate any help on this problem.

Sigmund Fjellberg
TELKO A/S
supp...@telko.no

 

Re:Outlook 97, Inbox, SenderName not avail. to Delphii


You're on the right track here, but you need to check the messageclass
attribute of the item BEFORE you go try to access
the sendername. Sendername is only valid for certain types of mailitem.
So far I've found that class 'IPM.Note' is the default for normal messages
and sendername is valid here,
but for example if you've got Non delivery reports then they don't have a
sendername attribute cause the've come from the mapi subsystem (or the
exchange administrator or whoever depending on you mailer)
If this doesn't help , I have a bit of code which walks the inbox displaying
various attributes which I could e-mail you. Its not much but your welcome
to it.

Ross Martin
Corporate Information Systems Manager
EMI Group Plc
Hayes,UK

Other Threads