Discussion:
Get image content ID from MAPI mail
(too old to reply)
Tora
2009-11-20 15:44:48 UTC
Permalink
Hi all,

I have got Outlook 2003 with an eMail that contains embedded pictures. I
need to read these eMails and their attachments including the Content ID.
I did already search the internet for a solution but could not find a
working solution so far. I do know that at a certain point in the
attachment there is written PR_ATTACH_CONTENT_ID / 0x3712001E) but I do
not know how to use this. I really hope that somebody can help me with
this problem. This is my programmed code that I do test at the moment. I
did define a special mailbox with folders in Outlook:

Private Function myModerator_OneFolder()
modname = "test user"
modmailaddr = "***@intern.local"
Postfach = "Postfach - Moderator, Mail"
Verzeichnis = "___Abgelehnt"
wegschicken = True
SubjZus = "Mail OK:"
ErrSubjZus = "Mail NOK:"

Dim fehler, wgfehler, respfehler, readfehler As Boolean

Set Folder =
Application.GetNamespace("MAPI").Folders.Item(Postfach).Folders(Verzeichnis)
Set GesFolder =
Application.GetNamespace("MAPI").Folders.Item(Postfach).Folders(Verzeichnis).Folders("Gesendet")


For i = Folder.Items.Count To 1 Step -1
Set from_Item = Folder.Items(i)
If from_Item.SenderEmailType = "SMTP" Then



For Each objSAttach In from_Item.Attachments
' >>>>>>>>>>>> How can I read out the content ID here?

Next
End If

Next 'mail
myModerator_OneFolder = True
Exit Function
End Function


Big big Thanks for help.

Best regards,
Tora
Michael Bauer [MVP - Outlook]
2009-11-20 18:37:30 UTC
Permalink
You need to use CDO 1.21 or Redemption (www.dimastr.com) in order to read
the property in Outlook 2003.

If you're going to use Redemption, see on Dmitry's page how to use the
SafeMailItem object. For the Attachment object derived from
SafeMailitem.Attachments you can read Attachment.Fields(&H3712001E).
--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>
Post by Tora
Hi all,
I have got Outlook 2003 with an eMail that contains embedded pictures. I
need to read these eMails and their attachments including the Content ID.
I did already search the internet for a solution but could not find a
working solution so far. I do know that at a certain point in the
attachment there is written PR_ATTACH_CONTENT_ID / 0x3712001E) but I do
not know how to use this. I really hope that somebody can help me with
this problem. This is my programmed code that I do test at the moment. I
Private Function myModerator_OneFolder()
modname = "test user"
Postfach = "Postfach - Moderator, Mail"
Verzeichnis = "___Abgelehnt"
wegschicken = True
SubjZus = "Mail OK:"
ErrSubjZus = "Mail NOK:"
Dim fehler, wgfehler, respfehler, readfehler As Boolean
Set Folder =
Application.GetNamespace("MAPI").Folders.Item(Postfach).Folders(Verzeichnis)
Post by Tora
Set GesFolder =
Application.GetNamespace("MAPI").Folders.Item(Postfach).Folders(Verzeichnis).Folders("Gesendet")
Post by Tora
For i = Folder.Items.Count To 1 Step -1
Set from_Item = Folder.Items(i)
If from_Item.SenderEmailType = "SMTP" Then
For Each objSAttach In from_Item.Attachments
' >>>>>>>>>>>> How can I read out the content ID here?
Next
End If
Next 'mail
myModerator_OneFolder = True
Exit Function
End Function
Big big Thanks for help.
Best regards,
Tora
Tora
2009-11-23 12:35:05 UTC
Permalink
Michael Bauer [MVP - Outlook] schrieb:

Hello Michael,

thanks for help. I have installed the CDO 1.21 in OL 2007 for testing
and I bring it not to work.

How can I get the CID in the cdo 1.21 library? Can you help me please.
Big thanks.

Best regards,
Tora
Post by Michael Bauer [MVP - Outlook]
You need to use CDO 1.21 or Redemption (www.dimastr.com) in order to read
the property in Outlook 2003.
If you're going to use Redemption, see on Dmitry's page how to use the
SafeMailItem object. For the Attachment object derived from
SafeMailitem.Attachments you can read Attachment.Fields(&H3712001E).
Michael Bauer [MVP - Outlook]
2009-11-23 17:18:55 UTC
Permalink
First you told us you use OL03. For OL07 you don't need CDO 1.21.

In OL07, you can use the PropertyAccessor object of the attachment:

Attachment.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E")
--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>
Post by Tora
Hello Michael,
thanks for help. I have installed the CDO 1.21 in OL 2007 for testing
and I bring it not to work.
How can I get the CID in the cdo 1.21 library? Can you help me please.
Big thanks.
Best regards,
Tora
Post by Michael Bauer [MVP - Outlook]
You need to use CDO 1.21 or Redemption (www.dimastr.com) in order to read
the property in Outlook 2003.
If you're going to use Redemption, see on Dmitry's page how to use the
SafeMailItem object. For the Attachment object derived from
SafeMailitem.Attachments you can read Attachment.Fields(&H3712001E).
Tora
2009-11-24 08:19:02 UTC
Permalink
Michael Bauer [MVP - Outlook] schrieb:

Hi Michael
Post by Michael Bauer [MVP - Outlook]
First you told us you use OL03. For OL07 you don't need CDO 1.21.
Attachment.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E")
Yes, I develop at this time under OL07 and the program runs after than
under OL02. Sorry, I have think that runs after the develop under OL03.

Can you say me what I must write under OL02 to get the property for the
CID please. Thanks.

Best regards,
Tora
Michael Bauer [MVP - Outlook]
2009-11-24 08:37:03 UTC
Permalink
Please read the suggested example on www.dimastr.com

This example uses the Redemption as well:
http://www.vboffice.net/sample.html?mnu=2&lang=de&smp=29&cmd=showitem

It's more complex than you need it, but you might learn a bit.
--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>
Post by Tora
Hi Michael
Post by Michael Bauer [MVP - Outlook]
First you told us you use OL03. For OL07 you don't need CDO 1.21.
Attachment.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E")
Post by Tora
Yes, I develop at this time under OL07 and the program runs after than
under OL02. Sorry, I have think that runs after the develop under OL03.
Can you say me what I must write under OL02 to get the property for the
CID please. Thanks.
Best regards,
Tora
Loading...