I found a bit of vb.net code on MSDN which sequences through an Outlook / Exchange mailbox. I've been unable to modify it to use Redemption (and avoid the security permissions dialog box). Could someone give me a hand?
The console application code is below. I've indicated sections of interest with '***
The error System.InvalidCast Exception occurs while looping through the inbox.
I know that I should change the line "Dim oItems As Outlook.Items = oInbox.Items" to something but I'm not sure what.
Any assistance is appreciated!
' Create Outlook application.
Dim oApp As Outlook.Application = New Outlook.Application
' String used for comparison with mail item.
Dim sClassComp = "IPM.Note"
' Get Mapi NameSpace.
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("MAPI")
' Get Messages collection of Inbox.
Dim oInbox As Outlook.MAPIFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
' *** Change line below to ??? to make Remedy Enabled.
Dim oItems As Outlook.Items = oInbox.Items
Console.WriteLine("Total : " & oItems.Count)
' Loop each unread message.
' *** Original Line is Below
' Dim oMsg As Outlook.MailItem
' Remedy Enabled
Dim sMsg As Redemption.SafeMailItem
Dim i As Integer
For i = 1 To oItems.Count
'Test to make sure item is a mail item
'and not a meeting request.
If oItems.Item(i).MessageClass = sClassComp Then
' *** System.InvalidCast Exception Occurs Here
sMsg = oItems.Item(i)
In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray.
The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
1.0 - Introduction
Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET).
If ever there was a subject full of murkiness and bad decisions, it is this one! The first problem seems to be that people considering this task of converting…