How did a NOTE get in my Inbox?

  • Thread starter Thread starter Phil
  • Start date Start date
P

Phil

I am using Outlook 2002 (xp) on a Windows 2000 Pro SP 4 platform. This
Outlook 2002 installation is part of a semi-automated mailing list system
that I have put together. There is some VBA running with Outlook, and I
have recently run into a situation that causes my VBA code to fail.
Basically, my VBA cycles through the Inbox every time Outlook automatically
fetches new mail off the POP server. The VBA exports the contents of each
message to a TXT file, and then deletes the mail item from the Inbox. It
has worked very well for months. But just recently the code has run into a
situation that I'm seeking a solution for. Someone on my mailing list is
sending me an automated reply while he is on vacation, but instead of his
reply appearing in my Inbox as a message item, it appears as a NOTE!
Yes...as a Microsoft Outlook yellow sticky note! I don't know how he pulls
this trick off, but it causes my VBA code to ignore everything in my Inbox.
Here are the key parts of my VBA code:

Dim myItem As MailItem

Set myFolder = GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)

For Each myItem In myFolder.Items

.....

Next

What is happening is that when the execution point hits the For EAch
statement, it trips an error/exception and hence never gets inside the loop.
I suspect the fact that this "note" that is in my Inbox is not considered to
be of "MailItem" type, and hence trips the error.

How do I resolve this problem?

A less important question is, how is this guy pulling this off...i.e., how
can he send me a NOTE as an email?

Thanks.
 
Resolve the problem by declaring your object as Object not MailItem.You then can determine what kind of item it is by looking at the Class or MessageClass property.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Am Fri, 16 Sep 2005 22:08:34 -0400 schrieb Phil:

Phil, please add this:

Dim obj a Object

For Each obj in myFolder.Items
If TypeOf obj is Outlook.MailItem Then
Set myItem=obj
' ...
Endif
Next
 
Resolve the problem by declaring your object as Object not MailItem.

Sue,

Thanks for the suggestion.

As far as my other question...How did this sender pull off the trick of
sending me a NOTE as an email...? It seems like a security threat, and
makes me uneasy.

Phil

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Interesting question, but not the first one I'd ask. That would be, what's the MessageClass value. Maybe it's not even a note at all?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Since you haven't posted the entire SUB, I can't provide specific help.
However, if you intend to work specifically with MailItems check insert
a IF...THEN that checks the type of item that the For Each is on.
 
Interesting question, but not the first one I'd ask. That would be,
Sue,

It clearly was not an email message, else it would not have jumped over my
For/Next loop where my VBA code was assuming that all items in the Inbox
were email messages. I remember that in my Preview pane in Outlook that the
"message" appeared with the same colors and font that my NOTES is configured
to.

Somehow I was able to access the OPTIONS for the object and found the
following in the header of the "message":

Subject: Thank you for your email however I will be sipping Voda Martini's
in St Tropez until the 25 September 05.

Date: Fri, 16 Sep 2005 08:32:47 +1000

Message-ID:

<!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAVtc7bcBKdE+A9PhVVhp7usKAAAAQ
(e-mail address removed)>

MIME-Version: 1.0

Content-Type: multipart/mixed;

boundary="----=_NextPart_000_0036_01C5BA99.39617CA0"

X-Mailer: Microsoft Office Outlook, Build 11.0.5510

X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180

Thread-Index: AcW6RWWyKIMDAqe2Tgm3xD9urhlKkA==

X-MS-TNEF-Correlator:

0000000056D73B6DC04A744F80F4F855561A7BBA84DD3100
 
Phil, please add this:

Michael,

I've implemented your suggestion, but I won't know until the next Outlook
"NOTE" is received whether it solved the problem or not. For now, thanks!

Phil


 
Am Sat, 17 Sep 2005 22:14:17 -0400 schrieb Phil:

Phil, don´t worry. I know it works.
 
You still need to check the Class or MailItem property for that item if you want to know what it really is. Write a little code snippet if you don't have Outlook Spy.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top