You cannot use the Item.Attachments.Add method to programmatically insert attachments into a specific position in an RTF e-mail message in Outlook 2007

This article has been archived. It is offered "as is" and will no longer be updated.
Symptoms
Consider the following scenario:
  • In Microsoft Office Outlook 2007, you try to send a Rich Text Format (RTF) e-mail message. Additionally, one or more attachments are contained in the body of the message.
  • You create a custom solution that implements the Application_ItemSend event or the Item_Send event in the Outlook object model and that uses the Item.Attachments.Add method to attach files in specific positions in the message body.
When you run the custom solution in this scenario, the attachments are not inserted in the positions that you specified in the message body.
Cause
Outlook 2007 lets you specify the positions of attachments when the attachments are programmatically attached to the messages. However, the positioning functionality does not work in the ItemSend or Item_Send events.
Resolution
This problem is fixed in the Word 2007 hotfix package that is dated February 24, 2009.

For more information, click the following article number to view the article in the Microsoft Knowledge Base:
967697 Description of the Word 2007 hotfix package (Outlook.msp, Word.msp): February 24, 2009
Note This hotfix package enables attachment-positioning functionality in the ItemSend and Item_Send events. However, this hotfix package does not directly affect the location at which attachments are positioned.
More information
For more information about this problem, note the following:
  • If Outlook 2003 is configured to use Word as the e-mail editor, and a custom solution uses the Outlook object model to remove attachments from Rich Text e-mail messages, an attachment placeholder tag (\objattph) in the underlying RTF stream may not be removed. If you then use the Outlook object model to insert attachments in these e-mail messages, Word may insert attachments at the placeholder position, regardless of the position that you specify in the Outlook object model.

    Note This Outlook 2003 problem cannot be fixed.
  • If Word is configured as the e-mail editor in Outlook 2003 and in earlier versions of Outlook, attachments are added to the end of the message body regardless of the specified positions. The native RTF handling in those earlier versions of Outlook does not directly correspond to RTF-handling functionality in Word. Word and those earlier versions of Outlook use the different ways to track character positions and the insertion point. Because Outlook 2007 now uses Word as the editor for all messages, this issue is more prevalent.

    There are some positions in the Word character stream at which you cannot insert attachments, such as at the end of a table row. When Word tries to insert an attachment at the end of a table row, Word backs up one position at a time (for a maximum of 10) until it either finds an available position or until it arrives at the beginning of the document. If Word still cannot find an available position, it inserts the attachment at the end of the document.
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.
Properties

Article ID: 967677 - Last Review: 01/16/2015 18:06:40 - Revision: 1.0

  • Microsoft Office Outlook 2007
  • kbnosurvey kbarchive kbqfe kbexpertiseinter KB967677
Feedback