I guess it's KB967677, although I'm pretty sure the patch is installed. It works perfectly with Outlook 2003.
Sorry for bothering.
题
I'm trying to position an attachment in an RTF mail of Outlook 2007 created via COM:
using Outlook = Microsoft.Office.Interop.Outlook;
// ...
private static void CreateMailWithAttachment()
{
Outlook.Application ol = new Outlook.Application();
Outlook.MailItem mail = (Outlook.MailItem) ol.CreateItem(Outlook.OlItemType.olMailItem);
mail.BodyFormat = Outlook.OlBodyFormat.olFormatRichText;
mail.Subject = "Important e-mail";
mail.Body = "1234567890 1234567890 1234567890";
mail.Attachments.Add(@"c:\myfile.txt", Outlook.OlAttachmentType.olByValue, 2);
mail.Display();
}
The documentation of Attachments.Add
does not explicitly say what happens when a value between 2 and the length of the mail is used:
This parameter applies only to e-mail messages using Microsoft Outlook Rich Text format: it is the position where the attachment should be placed within the body text of the message. A value of 1 for the Position parameter specifies that the attachment should be positioned at the beginning of the message body. A value 'n' greater than the number of characters in the body of the e-mail item specifies that the attachment should be placed at the end. A value of 0 makes the attachment hidden.
I'm seeing the following behavior:
0
: Works as described, attachment is hidden.1
: Does not work as described, attachment is at the end of the body.> 1
: Attachment is at the end of the body.It's the same when starting Outlook with command line arguments /noextensions
or /safe
.
Is it possible to position an attachment in the middle of a mail? Am I missing something?
解决方案
I guess it's KB967677, although I'm pretty sure the patch is installed. It works perfectly with Outlook 2003.
Sorry for bothering.