I'm creating the vb application using MAPI control. I've added both controls in my vb program (MapiSession & Mapimessages). Please check my below code.
Expand|Select|Wrap|Line Numbers
- Private Sub Form_Load()
- 'Sign on to the MAPI Session
- MAPISession1.SignOn
- MAPIMessages1.SessionID = MAPISession1.SessionID
- MAPIMessages1.Fetch
- If MAPIMessages1.MsgCount > 0 Then
- 'If there are messages, display the first one.
- txtFrom.Text = MAPIMessages1.MsgOrigDisplayName
- txtTo.Text = MAPIMessages1.RecipDisplayName
- txtSubject.Text = MAPIMessages1.MsgSubject
- txtMessage.Text = MAPIMessages1.MsgNoteText
- 'Enable the buttons to allow message navigation.
- cmdBack.Enabled = True
- cmdForward.Enabled = True
- cmdSend.Enabled = True
- Else
- 'No Messages? Tell the user immediately and Sign off!
- MsgBox "You have no messages”"
- MAPISession1.SignOff
- 'Disable the buttons to avoid error messages
- cmdBack.Enabled = False
- cmdForward.Enabled = False
- cmdSend.Enabled = False
- End If
- End Sub
Regards
C. Mahale