You cannot rename default folders by using the Outlook 2003 object model

This article has been archived. It is offered "as is" and will no longer be updated.

When you try to change the name of a default folder by using the Microsoft Office Outlook 2003 object model, you receive the following error message:
You don't have appropriate permission to perform this operation.
The Outlook 2003 object model was intentionally changed so that you cannot rename default folders.
To work around this problem, you can use the Collaboration Data Object (CDO) 1.21s object library. This library is included with Office 2003, but this library is not installed in a typical setup.

The following Microsoft Visual Basic or Microsoft Visual Basic for Applications sample code shows how you can automate both Outlook and CDO to rename the default folders. All the default folders are not easy to access by using the CDO object library because constants are not defined for the folders. Therefore, this sample uses the Outlook object library to access each default folder, and then accesses each folder in CDO by using the EntryID property and the StoreID property of the folder that is obtained from the Outlook object model.

Note To use the following sample, you must reference the Microsoft Outlook 11.0 Object Library and the Microsoft CDO 1.21 Library.
Dim objOLApp As Outlook.ApplicationDim objOLSession As Outlook.NameSpaceDim objCDOSession As MAPI.SessionSub ChangeDefaultFolderNames()   ' Get the Outlook objects   Set objOLApp = New Outlook.Application   Set objOLSession = objOLApp.Session   'Get the CDO objects, using the existing Outlook session for CDO logon   Set objCDOSession = New MAPI.Session   objCDOSession.Logon , , False, False   ' Skip over any folders that might not be there. This is   ' mainly for the SyncIssues folder (and the following three)   ' because they are only available in cached Exchange mode.   On Error Resume Next   ChangeFolderName objOLSession.GetDefaultFolder(olFolderCalendar), "Calendar"   ChangeFolderName objOLSession.GetDefaultFolder(olFolderContacts), "Contacts"   ChangeFolderName objOLSession.GetDefaultFolder(olFolderDeletedItems), "Deleted Items"   ChangeFolderName objOLSession.GetDefaultFolder(olFolderDrafts), "Drafts"   ChangeFolderName objOLSession.GetDefaultFolder(olFolderInbox), "Inbox"   ChangeFolderName objOLSession.GetDefaultFolder(olFolderJournal), "Journal"   ChangeFolderName objOLSession.GetDefaultFolder(olFolderJunk), "Junk E-mail"   ChangeFolderName objOLSession.GetDefaultFolder(olFolderNotes), "Notes"   ChangeFolderName objOLSession.GetDefaultFolder(olFolderOutbox), "Outbox"   ChangeFolderName objOLSession.GetDefaultFolder(olFolderSentMail), "Sent Items"   ChangeFolderName objOLSession.GetDefaultFolder(olFolderSyncIssues), "Sync Issues"   ChangeFolderName objOLSession.GetDefaultFolder(olFolderConflicts), "Conflicts"   ChangeFolderName objOLSession.GetDefaultFolder(olFolderLocalFailures), "Local Failures"   ChangeFolderName objOLSession.GetDefaultFolder(olFolderServerFailures), "Server Failures"   ChangeFolderName objOLSession.GetDefaultFolder(olFolderTasks), "Tasks"   objCDOSession.Logoff   Set objCDOSession = Nothing   Set objOLSession = Nothing   Set objOLApp = NothingEnd SubSub ChangeFolderName(objOLFolder As Outlook.MAPIFolder, strNewName As String)   Dim objCDOFolder As MAPI.Folder   ' Reference the folder by using CDO   Set objCDOFolder = objCDOSession.GetFolder(objOLFolder.EntryID, objOLFolder.StoreID)   ' Change the folder's name   objCDOFolder.Name = strNewName   ' Save changes to the folder   objCDOFolder.Update   Set objCDOFolder = NothingEnd Sub

Article ID: 831363 - Last Review: 12/08/2015 05:17:25 - Revision: 1.3

Microsoft Office Outlook 2003, Microsoft Collaboration Data Objects 1.21

  • kbnosurvey kbarchive kbprb KB831363