Microsoft KB Archive/284604

= INFO: Logging On to Exchange by Using CDO Can Create Default Folders =

Article ID: 284604

Article Last Modified on 2/22/2007

-

APPLIES TO


 * Microsoft Exchange Server 5.5 Standard Edition
 * Microsoft Exchange 2000 Server Standard Edition
 * Microsoft Collaboration Data Objects 1.21
 * Microsoft Outlook 98 Standard Edition
 * Microsoft Outlook 2000 Standard Edition

-



This article was previously published under Q284604



SUMMARY
When you use Collaboration Data Objects (CDO) to log on to a mailbox and access any Outlook default folder, all Outlook default folders are created if they do not already exist.



MORE INFORMATION
When a new mailbox is created on Exchange Server, the only folders that Exchange creates are the Inbox, Outbox, Deleted Items, and Sent Items folders. The default Outlook folders (Calendar, Contacts, Tasks, Drafts, and Journal) are not created. The first time the Outlook client logs onto the mailbox, Outlook creates these folders.

You may want to create these folders before the Outlook client first logs on to the mailbox. To do this, log on to the mailbox with CDO and access one of the default folders. If they are not present, all of the Outlook folders are created by this attempt.

To do this, follow these steps:  Create a new mailbox on your Exchange server. Log on to the new mailbox by using Mdbvu32.exe. Browse to Top of Information Store. Under Child Folders, you see Inbox, Outbox, Sent Items, and Deleted Items. The other default folders are not present at this time. In Microsoft Visual Basic, create a new Standard EXE project, and add a reference to the CDO 1.21 library.  Add a button to the form, and paste the following code in the button's Click event: Private Sub cmdCreateCalendar_Click Dim oSession As MAPI.Session Dim strProfile As String Dim oCalendar As MAPI.Folder Set oSession = CreateObject(&quot;MAPI.Session&quot;) ' TO DO: ' Be sure to replace &quot;server_name&quot; with the name of your Exchange server ' and replace &quot;mailbox_alias&quot; with the alias of your newly created mailbox. strProfile = &quot;server_name&quot; & vbLf & &quot;mailbox_alias&quot; oSession.Logon, , False, True, , True, strProfile ' Default folders are created when the next line is called. Set oCalendar = oSession.GetDefaultFolder(CdoDefaultFolderCalendar) oSession.Logoff Set oCalendar = Nothing Set oSession = Nothing End Sub  Run the project, click the button to run the code, and then close the program. Log on to the mailbox again by using Mdbvu32.exe. Browse to Top of Information Store. Now, under Child Folders, you see all of the Outlook default folders.</li></ol>

NOTE: The sample code accesses the Calendar folder, but you can also do this by accessing any of the following default folders:
 * CdoDefaultFolderCalendar
 * CdoDefaultFolderContacts
 * CdoDefaultFolderJournal
 * CdoDefaultFolderNotes
 * CdoDefaultFolderTasks

Additional query words: mdbvu32 exe

Keywords: kbinfo kbmsg KB284604

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.