Identify Read Recepits

S

Sanya Ibrahim

Hi,
I am using Outlook 2007. In the NewMail event, is it possible to identify if
the MailItem is a read receipt?
Could someone help me?
Thanks in advance.
 
K

Ken Slovak - [MVP - Outlook]

Look for a MessageClass property that starts with "REPORT.IPM.Note" and ends
with "IPNRN" to identify a read receipt.
 
S

Sanya Ibrahim

Thanks for the reply.
Well, I am rather new to OutLook vba. Is it possible for you to give a
sample / example code?
Sanya
 
K

Ken Slovak - [MVP - Outlook]

Well, for one thing I wouldn't use NewMail(). It doesn't tell you what was
received and it misses things. I'd use NewMailEx() instead, which supplies a
list of items received as a list of EntryID's.

Always use F2 to open the Object Browser and that lets you see all methods,
properties and events for all Outlook items. Then use the Help to see code
samples. In the case of Application.NewMailEx() the code sample shows how to
get an item from the collection of EntryID's. That item (mai) can be used
thusly to check the MessageClass:

If ((Left(mai.MessageClass, Len("REPORT.IPM.Note")) = _
"REPORT.IPM.Note") And (Right(mail.MessageClass, _
Len("IPNRN")) = "IPNRN")) Then

' this is a read receipt, do whatever

End If

You should also become familiar with the www.outlookcode.com Web site, that
has code samples for almost anything Outlook related.
 
S

Sanya Ibrahim

Well, I tried it. I am getting into a strange situation wherein:-
(a) The EntryCollection argument has string values
(b) I split the EntryCollection string on "," and use the individual
EntryID strings to retrieve the mail Items
(c) However, the GetItemFromID(EntryID) returns nothing. The EntryID
argument is not null and the value does not correspond to the new inmail.

What to do?
 
K

Ken Slovak - [MVP - Outlook]

That is the correct procedure, and it has worked that way for me in the
past.

Are you using a StoreID argument? I'd try that and see if it helps. You can
get Inbox using NameSpace.GetDefaultFolder(olFolderInbox) and use the
StoreID property from that object.

Are you getting any exceptions or just nothing?
 
S

Sanya Ibrahim

I am using a storeID arguement. I am not getting any exception but the
MaiItem is showing as nothing.

Sanya
 
K

Ken Slovak - [MVP - Outlook]

No idea. Similar code works here. Step the code in the debugger and see if
you can find out that way what the problem is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top