How to log on to Exchange with the ProfileInfo parameter

Article translations Article translations
Article ID: 195662 - View products that this article applies to.
This article was previously published under Q195662
Expand all | Collapse all

On This Page

SUMMARY

With Collaboration Data Objects (1.2, 1.21), you can log on to an Exchange Server mailbox using the ProfileInfo parameter. This article describes how to use the ProfileInfo parameter and why you would use it.

MORE INFORMATION

Description

The Logon method of the Session object has the following syntax:
objSession.Logon( [profileName] [, profilePassword] [, showDialog]
       [, newSession] [, parentWindow] [, NoMail] [, ProfileInfo] )
				
You use the ProfileInfo parameter of the Logon method to create a temporary profile for the session. CDO (1.2, 1.21) creates a random name for the profile. For an authenticated profile, use the following format for the string:
   "<server name>" & vbLf & "<mailbox name>"
				
The server and mailbox names can be unresolved. Note that the mailbox name is not the messaging user's display name, but rather the alias or account name used internally by the user's organization.

For example, you should use "johnd" instead of "John Doe". The profile is deleted after the Session is completed or terminated. Only applications interfacing with the "Microsoft Exchange Server" service and no other services may use the ProfileInfo parameter. The profileName parameter is ignored if ProfileInfo is supplied.

Reasons for Use

Use the ProfileInfo parameter in any of the following cases:
  1. You do not know what profiles exist on a computer or you do not want to rely on them being there. This is very common when you run code from a Windows NT Service or Active Server Page.
  2. You do not want to run the code that is required to determine the default profile for the current user. For more information abiyt determining the default profile, click the following article number to view the article in the Microsoft Knowledge Base:
    171422 How to use CDO (1.x) to log on to a MAPI session by using the default profile of the current user
  3. You want to allow users the ability to log on to the Exchange Server without an authenticated Windows NT account and have anonymous access to Public Folders. For more information how to configure public folders for anonymous Web access, click the following article number to view the article in the Microsoft Knowledge Base:
    168661 Accessing public folders via a Web browser causes error

Sample Code

  • Logging onto a mailbox from a Visual Basic application:
          objSession.Logon ProfileInfo:="MyServer" & vbLf  & "MyMailbox""MyMailbox"
    					
  • Logging onto a mailbox from an Active Server Page:
          objSession.Logon "", "", False, True, 0, True, _
              "MyServer" & vbLf & "MyMailbox"
    					
  • Logging on anonymously from a Visual Basic application:
          objSession.Logon ProfileInfo:="/o=MyEnterprise/ou=MySite" & _
                         "/cn=Configuration/cn=MyServer" & vbLf & _
                         vbLf & "anon"
    					
  • Logging on anonymously from an Active Server Page:
          objSession.Logon "", "", False, True, 0, True, _
              "/o=MyEnterprise/ou=MySite/cn=Configuration/cn=MyServer" & _
              vbLf & vbLf & "anon"

Properties

Article ID: 195662 - Last Review: June 27, 2005 - Revision: 5.0
APPLIES TO
  • Microsoft Collaboration Data Objects 1.21
  • Microsoft Collaboration Data Objects 1.2
Keywords: 
kbhowto kbmsg KB195662
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com