Outlook not finding inbox or default folders.

L

Lee

I am having outlook give me an error everytime I try to get any default
folder. It just gives out and says the operation failed. It will work
sometimes, but not others. It usually breaks on the service account that
runs it through SQL server. Please let me know what I am doing wrong.
Thanks.

Dim MainFolder As outlook.MAPIFolder
Dim objtargetFolders(Num) As outlook.MAPIFolder
Dim NS As NameSpace

Set NS = outlook.Application.GetNamespace("MAPI")
Set MainFolder = NS.GetDefaultFolder(olPublicFoldersAllPublicFolders)
 
E

Eric Legault [MVP - Outlook]

Are you logged in to an Outlook profile that is using that service account
when you run the code?
 
D

Dmitry Streblechenko

Also note that running Outlook in a service (even if it is set to use a
Windows user account that has a configured profile) is a very bad idea,
totatlly unsupported by MS.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Top