J
Jonatan
Hi there,
I am stuck in a problem and I don't seem to find the answer in the
groups.
I am developing an addin in c# in outlook 2003.
When the user forwards one PostItem, outlook creates a MailItem and
puts the documents contained in the PostItem as attachment of the
MailItem.
When the user forwards two or more Post Items together, outlook creates
a MailItem and puts the PostItems as attachments. Each of them with its
attachments.
I am capturing the item send event. I want to remove the PostItems from
the attachments of the MailItem and just leave the attachments that the
PostItems contain.
That has been impossible to accomplish!
When I get the attachmets of the MailItem I get a ".msg". It is not
possible to get its attachments using the Outlook object model.
I read in the groups that you can access to the attachments using
Redemption because it has the EmbeddedMsg property. I tried it but to
no avail.
The first problem with Redemption is that when I set the Item property
of the SafeMailItem, the attachments collection continues being null.
Then I decided to save the attachments in the hard disk and then add an
Redemption Attachment. No joy. The property EmbeddedMsg is null.
I am posting the code, I may be doing something wrong!
Outlook.MailItem mailItem ... // This is the MailItem that I receive
from the ItemSend event
Redemption.SafeMailItem safeMailItem = new
Redemption.SafeMailItemClass();
safeMailItem.Item = mailItem;
// I can't use safeMailItem Attachments.Count because is 0
if (mailItem.Attachments.Count > 1)
{
for (int i = mailItem.Attachments.Count; i > 0; i--)
{
Outlook.Attachment attachment = mailItem.Attachments;
attachment.SaveAsFile(@"c:\" + fileName.ToUpper());
safeMailItem.Attachments.Add(@"c:\" + fileName.ToUpper(),
Outlook.OlAttachmentType.olByValue, 1, fileName);
Redemption.Attachment safeAttachment = safeMailItem.Attachments[1];
// This line crashes because the EmbeddedMsg is null (not
defined)
Redemption.MessageItem messageItem =
safeAttachment.EmbeddedMsg;
}
I am stuck in a problem and I don't seem to find the answer in the
groups.
I am developing an addin in c# in outlook 2003.
When the user forwards one PostItem, outlook creates a MailItem and
puts the documents contained in the PostItem as attachment of the
MailItem.
When the user forwards two or more Post Items together, outlook creates
a MailItem and puts the PostItems as attachments. Each of them with its
attachments.
I am capturing the item send event. I want to remove the PostItems from
the attachments of the MailItem and just leave the attachments that the
PostItems contain.
That has been impossible to accomplish!
When I get the attachmets of the MailItem I get a ".msg". It is not
possible to get its attachments using the Outlook object model.
I read in the groups that you can access to the attachments using
Redemption because it has the EmbeddedMsg property. I tried it but to
no avail.
The first problem with Redemption is that when I set the Item property
of the SafeMailItem, the attachments collection continues being null.
Then I decided to save the attachments in the hard disk and then add an
Redemption Attachment. No joy. The property EmbeddedMsg is null.
I am posting the code, I may be doing something wrong!
Outlook.MailItem mailItem ... // This is the MailItem that I receive
from the ItemSend event
Redemption.SafeMailItem safeMailItem = new
Redemption.SafeMailItemClass();
safeMailItem.Item = mailItem;
// I can't use safeMailItem Attachments.Count because is 0
if (mailItem.Attachments.Count > 1)
{
for (int i = mailItem.Attachments.Count; i > 0; i--)
{
Outlook.Attachment attachment = mailItem.Attachments;
attachment.SaveAsFile(@"c:\" + fileName.ToUpper());
safeMailItem.Attachments.Add(@"c:\" + fileName.ToUpper(),
Outlook.OlAttachmentType.olByValue, 1, fileName);
Redemption.Attachment safeAttachment = safeMailItem.Attachments[1];
// This line crashes because the EmbeddedMsg is null (not
defined)
Redemption.MessageItem messageItem =
safeAttachment.EmbeddedMsg;
}