Schröder Heiko
Posts: 2
Joined: 2025-02-05
|
Hello,
I want to iterate the mails and each attachment of them.
I need only the attachments, which are not embedded. That means, I don't want images from inside the mail.
I've found some source codes for VBA, which can't converted to Delphi.
For Each olMailItem In olFolder.Items
If TypeName(olMailItem) = "MailItem" Then
For i = 1 To olMailItem.Attachments.Count
Set olAttachment = olMailItem.Attachments(i)
If olAttachment.Type = olByValue Then
Debug.Print "Attachment: " & olAttachment.FileName & " (normal)"
ElseIf olAttachment.Type = olEmbeddeditem Then
Debug.Print "Attachment: " & olAttachment.FileName & " (embedded)"
End If
Next i
End If
Next olMailItem
This is my code in Delphi.
for var e : integer := iMailStart to mailItems.Count do
begin
IDisp := mailItems.Item(e);
if IDisp.QueryInterface(IID__MailItem, mail) = S_OK then
begin
for var a : integer := 1 to mail.Attachments.Count do
begin
strAttachmentName := mail.Attachments.Item(a).FileName; /// works
// no embedded elements
if (mail.Attachments.Item(a).type_ = olEmbeddeditem) then /// <<<------
continue
else
// alternate sourcecode
end;
end;
My problem is, that I don't get the right type information... What's wrong?
For your information: I did typecast the Outlook2000 to Outlook2010. I don't need older versions of Outlook. |
|
Andrei Smolin
Add-in Express team
Posts: 19075
Joined: 2006-05-11
|
|
Schröder Heiko
Posts: 2
Joined: 2025-02-05
|
Hello,
many thanks for your fast repsonse. I will try it. |
|