'VB 2010 and Outlook: how does the VB application know which mailbox to access?
I have a VB project which is a server for an enterprise client app I wrote for iOS. The server works great on the development machine, and I was ready to deploy it to its permanent home in another box. Everything works great except for one thing. One of the functions is to periodically scan my Outlook/Exchange email box for certain emails and extract the message body and process that information. On the production server it throws an error:
Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
Here is the setup code that runs the scan:
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objInboxFolder As Outlook.Folder
Dim olTVMFolder As Outlook.Folder
Dim olDestinationFolder As Outlook.Folder
Dim msg As Outlook.MailItem
Dim msgBody As String
Dim msgSender As String
Dim msgReceivedTime As String
olApp = New Outlook.Application
objNS = olApp.GetNamespace("MAPI")
objInboxFolder = objNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
olTVMFolder = objInboxFolder.Folders("TVM Backup")
olDestinationFolder = objInboxFolder.Folders("Processed TVM")
Which I mostly copied from somewhere on the internet.
All this was done so early in the development that I have forgotten how I managed to get this to work, so I am stumped again trying to make it work on the new hardware. What do I need to do to get over this speed bump?
I'm also stumped trying to figure how it knew to access my mailbox.
Thanks a bunch.
Solution 1:[1]
The error means that Outlook is not installed.
Keep in mind that no Office app (Outlook included) can be used in a service. Your choices are
Extended MAPI (C++ or Delphi)
EWS (in case of an Exchange mailbox)
Redemption (I am its author) - it wraps Extended MAPI and its RDO family of objects can be used in a service. It can be used in any language.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |