A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Is there a way to get the profile name



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 5th 08, 12:04 AM posted to microsoft.public.outlook.program_vba
salad
external usenet poster
 
Posts: 27
Default Is there a way to get the profile name

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?

Ads
  #2  
Old November 5th 08, 01:50 PM posted to microsoft.public.outlook.program_vba
Alan Moseley
external usenet poster
 
Posts: 61
Default Is there a way to get the profile name

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

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"Salad" wrote:

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?


  #3  
Old November 5th 08, 03:26 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Is there a way to get the profile name

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.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Alan Moseley" wrote in message
...
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

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"Salad" wrote:

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?



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I set up a new profile? Shauna Outlook - Installation 6 March 30th 07 06:34 PM
How do I set up a new profile High Desert Outlook - Using Contacts 5 March 30th 07 06:31 PM
More than one OL profile under one Windows profile in OL 2K Storfille Outlook - Installation 2 March 19th 07 10:39 AM
what is a profile Anjali Outlook - General Queries 1 August 8th 06 07:26 PM
Profile profile Outlook Express 1 March 25th 06 03:34 AM


All times are GMT +1. The time now is 07:11 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.