The message body still shows a message attachments that you deleted by using the Outlook Object Model in Outlook 2002 and in Office Outlook 2003 (919454)



The information in this article applies to:

  • Microsoft Outlook 2002
  • Microsoft Office Outlook 2003

SYMPTOMS

Consider the following scenario. You create an e-mail message in Microsoft Outlook 2002 or in Microsoft Office Outlook 2003. You add an attachment to the e-mail message. All the following conditions are true:
  • You are using Outlook to connect to a Microsoft Exchange mailbox that has exceeded its storage limit.
  • You are running Outlook in online mode.
  • You are using Microsoft Office Word as the e-mail message editor.
  • You are composing messages in Rich Text Format (RTF).
In this scenario, when you delete the attachment from the e-mail message in the Item_Write event of the Outlook Object Model, the message body still shows the attachment.

Additionally, if you try to send or to save the e-mail message the first time, the Mailbox Cleanup dialog box appears as expected. However, if you try to send or to save the e-mail message again, you receive the following error message:
The operation failed.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Steps to reproduce the problem

  1. Set up an Exchange mailbox that exceeds its storage limit.
  2. Start Outlook, and then connect to the Exchange mailbox.
  3. On the Tools menu, point to Macro, and then click Visual Basic Editor. Paste the following Visual Basic for Applications (VBA) code example into the code window.

    Note This VBA code example deletes all the attachments for a message by using the Outlook Object Model.
    Dim WithEvents olInsp As Outlook.Inspectors 
    Dim WithEvents myItem As Outlook.MailItem 
    Dim WithEvents myInsp As Outlook.Inspector
     
    Private Sub Application_Startup() 
        Set olInsp = Outlook.Inspectors 
    End Sub
     
    Private Sub myItem_Write(Cancel As Boolean) 
       Dim oAtt As Outlook.Attachment 
       Dim i As Integer 
       If myItem.Attachments.Count > 0 Then 
          For i = myItem.Attachments.Count To 1 Step -1 
             Set oAtt = myItem.Attachments.Item(i) 
             oAtt.Delete 
             Set oAtt = Nothing 
          Next 
       End If 
        
    End Sub
     
    Private Sub olInsp_NewInspector(ByVal Inspector As Inspector) 
        On Error GoTo err 
          Set myInsp = Inspector 
          Set myItem = myInsp.CurrentItem 
          Exit Sub 
    err: 
          MsgBox err.Description 
    End Sub
     
    Private Sub Application_Quit() 
        Set myItem = Nothing 
        Set myInsp = Nothing
        Set olInsp = Nothing 
    End Sub
    
  4. On the File menu, click Save.
  5. On the File menu, click Close and Return to Microsoft Office Outlook.
  6. On the File menu, click Exit to exit Outlook.
  7. Start Outlook.
  8. On the Tools menu, click Options.
  9. Click the Mail Format tab.
  10. In the Compose in this message format box, click Rich Text.
  11. Click to select the Use Microsoft Office Word 2003 to edit e-mail messages check box, and then click to select the Use Microsoft Office Word 2003 to read Rich Text e-mail messages check box.
  12. Click OK.
  13. On the File menu, point to New, and then click Mail Message.
  14. Type an e-mail address in the To box, and then add an attachment to the message.
  15. Click Send.
  16. When the Mailbox Cleanup dialog box appears, click Close. Notice that the attachment still appears in the message body.
  17. Click Send again. You receive the error message that is mentioned in the "Symptoms" section.

REFERENCES

For more information about the Write event in the Outlook Object Model, visit the following Microsoft Developer Network (MSDN) Web site:

Modification Type:MajorLast Reviewed:6/7/2006
Keywords:kbExpertiseAdvanced kbprb KB919454 kbAudDeveloper