How to detect Exchange?

  • Thread starter Martynas Kunigelis
  • Start date
M

Martynas Kunigelis

Hi,

Is there a way to programatically determine whether Outlook is running in an
Exchange environment, or in a simple POP3/SMTP setup?

More specifically, is there a way to find out whether the
Redemption::MAPIUtils::DeliverNow() will work as expected, or whether the
simulated click on the Send/Recv toolbar button is required?

Thanks in advance!
Martynas
 
K

Ken Slovak - [MVP - Outlook]

Using CDO 1.21 code:

Private Function Exchange() As Boolean
Dim objInfostore As MAPI.InfoStore
Dim objCDO As MAPI.Session

On Error Resume Next

Set objCDO = CreateObject("MAPI.Session")
objCDO.Logon "", "", False, False
Set objInfostore = objCDO.GetInfoStore(objCDO.Inbox.StoreID)

If Not objInfostore Is Nothing Then
If InStr(1, objInfostore.Fields(CdoPR_PROVIDER_DISPLAY),
"Microsoft Exchange", _
vbTextCompare) > 0 Then

Exchange = True
Else
Exchange = False
End If
Else
Exchange = False
End If

Set objInfostore = Nothing
End Function

A quick and dirty way using the Outlook object model would be to get
Inbox.Parent and see what the folder name is:
If InStr(1, strFolderName, "Mailbox", vbTextCompare) > 0 Then
'using Exchange mailbox
End If

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top