Is there a way to get the profile name

S

Salad

Is there a way to determine what the profile name that is in use in an
Outlook session? If so, can you provide a small code snippet
demonstration it or tell me what method or property to use?
 
A

Alan Moseley

You cannot do this from the Outlook Object Model, but if you download and
install CDO 1.21 you can use the following function:-

Public Function GetProfileName() As String
Dim MySession As MAPI.Session
Set MySession = CreateObject("MAPI.Session")
MySession.Logon "", "", False, False
GetCurrentProfileName = MySession.Name
MySession.Logoff
Set MySession = Nothing
End Function
 
K

Ken Slovak - [MVP - Outlook]

The CDO download is only for Outlook 2007, where there is already a
NameSpace.CurrentProfileName property available. CDO 1.21 for earlier
versions of Outlook is located on the Office CD.

Also, if the code is to be managed code CDO is not supported for use in
managed code.
 
Top