Hallo Leute,
ich möchte die Anhänge einer E-Mail in Outlook lokal speichern, dazu öffne ich das MailItem und durchlaufe die Anhänge, das Problem ist, als Anhang werden mir auch die eingebetetten Bilder einer HTML-Mail zurückgegeben, wir kann ich das unterbinden bzw. unterscheiden zwischen Anhang und Body-Bilder?
Object selObject = this.ActiveExplorer().Selection[1];
Outlook.MailItem mailItem = (selObject as Outlook.MailItem);
if (selObject is Outlook.MailItem)
{
int attCount = mailItem.Attachments.Count;
for (int i = 1; i <= attCount; i++)
{
Outlook.Attachment a = mailItem.Attachments[i];
....
....
}
}
danke
Wenn jemand gutes über dich denkt, dann bemühe dich dass er recht hat.
Hi, evtl. hilfts ja noch.
Du musst dir die folgenden MAPI-Properties des Anhangs ansehen
0x7FFE000B = PR_ATTACHMENT_HIDDEN
0x3712001E = PR_ATTACH_CONTENT_ID
0x3713001E = PR_ATTACH_CONTENT_LOCATION
0x37050003 = PR_ATTACH_METHOD
Ich habe dasselbe Problem und muss diese Properties abfragen.
Doch wie mache ich das?
Nur der vollständigkeit halber:
Am Attachment gibts einen PropertyAccessor dem man einen Namespace reinreichen kann, und dann den entsprechenden Wert zurück bekommt.:
attachment.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001F"); //PR_ATTACH_CONTENT_ID
attachment.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x7FFE000B"); // PR_ATTACHMENT_HIDDEN
attachment.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3713001F"); // PR_ATTACH_CONTENT_LOCATION
attachment.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x37050003"); // PR_ATTACH_METHOD