test for new message

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using the NewInspector event in the ThisOutlookSession module to
customise how users are greeted when they create a new message. I'm using:
If TypeOf Inspector.CurrentItem Is Outlook.MailItem
to make sure this code only runs for a message (and not a contact or
anything else that's being created!).

That's fine - however, I also need a test to stop the code running if the
user opens up an old message. Does anyone know a neat way of doing this?
The only thoughts I've had are the messages Saved property (which doesn't
work because it shows as True even for a new message) and testing that the
Inspector's Caption starts with "Untitled" (which of course includes old
messages without a subject).

Thanks
 
I use this. It's VB.NET but you can get the idea.

''' <summary>
''' Returns true or false depending on whether or not this object is new
(not been saved).
''' </summary>
Public ReadOnly Property IsNew() As Boolean
Get
' If no entry id and size is 0 then it is new
Return String.IsNullOrEmpty(_baseItem.EntryID) AndAlso _baseItem.Size = 0
End Get
End Property
 
Back
Top