Link to home
Start Free TrialLog in
Avatar of Mahesh Yadav
Mahesh YadavFlag for India

asked on

How to find out that MailItem object is a new Email or an recieved mail

I am creating an Outlook 2010 Addin,
Now I am giving the feature to open a new email window or an received email.

but I need to figure out that MailItem object is a new email or an Received email object.
could any help me out here

I am this code
 Dim MailItem As Outlook._MailItem
        Dim Application As Outlook.Application
       
        Application = New Outlook.Application()
        For Each inspector In Application.Inspectors
            If TypeOf inspector.CurrentItem Is Outlook.MailItem Then
                MailItem = inspector.CurrentItem
                MailItem.Body += PropertyInfoString
                Exit Sub
            End If
        Next inspector

        MailItem = TryCast(Application.CreateItem(Outlook.OlItemType.olMailItem), Outlook._MailItem)
        If MailItem IsNot Nothing Then
            MailItem.Body += PropertyInfoString
            MailItem.Display(False)
        End If
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial