Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PR_ATTACH_MIME_TAG errors with invalid parameter? 1

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
GB
Hi,

I'm tying to replace CDO1.2.1, only I can't seem to get the PR_ATTACH_MIME_TAG to work, here is what I have...
Code:
Set oPA = l_Attach.PropertyAccessor
oPA.SetProperty PR_ATTACH_MIME_TAG, ItemTypes.Item(x)

But it just errors with
Could not complete the operation. One or more parameter values are not valid
whether the value of ItemTypes.Item(x) equals "text/css" , "image/gif" or "image/jpeg"

Any ideas why this is happening?

Thanks,
1DMF



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
Right I'm getting somewhere...1stly they are constants that need to be defined with a value...I have this
Code:
    Const PR_ATTACH_MIME_TAG = "[URL unfurl="true"]http://schemas.microsoft.com/mapi/proptag/0x370E001E"[/URL]
    Const PR_ATTACH_CONTENT_ID = "[URL unfurl="true"]http://schemas.microsoft.com/mapi/proptag/0x3712001E"[/URL]
    Const PR_HIDE_ATTACH = "[URL unfurl="true"]http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8514000B"[/URL]

Then my code is as follows...
Code:
        ' Set attachments
        Set colAttach = l_Msg.Attachments

        ' loop and set items as mime attachments
        For x = 1 To Items.Count
            Set l_Attach = colAttach.Item(x)
            Set oPA = l_Attach.PropertyAccessor
            oPA.SetProperty PR_ATTACH_MIME_TAG, ItemTypes.Item(x)
            oPA.SetProperty PR_ATTACH_CONTENT_ID, "item" & x
            oPA.SetProperty PR_HIDE_ATTACH, True
            l_Msg.Save
        Next x

However, if I view the email in MSOutlook 2010 , only one attachment is hiden, if i view the email in MSO2003 all attachments are hidden correctly.

Infact my code now works, and displays EXACTLY as it should , referencing the inline images with 'cid' and they are all hidden but ONLY in MSO2003.

in MSO2010 , only one attachment is hidden and the email displays all over the place, if I click to 'view in browser' it still
doesn't display correctly.

Does this mean that basically MSO2010 doesn't work properly?

I'm creating the email using OOM in MSO2010 , but it only displays correctly in Outlook 2003?

What am i doing wrong and how do I get MS outlook 2010 to send and display the email correctly?

Thanks,
1DMF




"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
Have you tried PR_ATTACHMENT_HIDDEN rather than PR_HIDE_ATTACH?
 
no, I want to , but can't find the darn value for the name space to set the constant 'PR_ATTACHMENT_HIDDEN'.

if you would be so kind as to give me either the mapi 'proptag' or mapi 'id' namespace value for this property I'll give it a whirl.

I've got a very sore forehead at the moment banging it against google trying to find the answer!

Why oh why hasn't microsoft provided a full list of namespace properties and their values? [banghead]



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
Thanks strongm,

Where did you manage to find that? it still doesn't work though, works when viewing the email in MSO2003 , not in MSO2010.

I've even tried
Code:
            oPA.SetProperty PR_ATTACHMENT_HIDDEN, True
            Set oPA = Nothing
            Set oPA = l_Msg.PropertyAccessor
            oPA.SetProperty PR_ATTACHMENT_HIDDEN, True
so applying the hide attachment to both the attachment and the message, it only ever hides the first attachment.

Any other suggestions, or is it a case that MSO2010 doesn't work properly?




"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
>Where did you manage to find that?

I used the developer version of Redemption to look it up ...

It's certainly sounding like MSO2010 doesn't work properly with these properties. I wonder if it has some additional ones to achieve the same thing. Don't currently have it installed on an accessible machine, so can't investigate at the moment.
 
dang, it's very odd, as it displays fine when using an MSO 2003 client to view the email even though it is sent via MSO2010 using the Outlook Object Model.

I've also noticed that it's not the first attachment that gets hidden, just the first image attachment, the first attachment is the CSS file for the HTML email, the rest of the attachments are images and only the first gets hidden, so actually two attachments are mime inline encoded, the first CSS file and the first image.

Not sure if this helps with what might be wrong, I'm going to try with multiple text files and see if it's just the first file of each type that gets hidden?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
Just to confirm , it's the first TWO attachments that get encoded regardless of what type they are?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
I've just done a test with the folowing...
Code:
        ' loop and set items as mime attachments
        For x = 1 To Items.Count
            Set l_Attach = colAttach.Item(x)
            Set oPA = l_Attach.PropertyAccessor
            oPA.SetProperty PR_ATTACH_MIME_TAG, ItemTypes.Item(x)
            oPA.SetProperty PR_ATTACH_CONTENT_ID, "item" & x
            'oPA.SetProperty PR_ATTACHMENT_HIDDEN, True
        Next x

You'll notice that I have commented out setting the attachment to hidden, and guess what!

Yup it does exactly the same, hides the first two attachments only and in MSO 2003 all the attachments given a CID are hidden even though I'm not even setting the MAPI namespace for hiding the attachment.

What is going on?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
I don't think MSO 2010 is working poperly, as I'm not sure the namespace is allowing alteration to it.

i put the following code
Code:
            oPA.SetProperty PR_HIDE_ATTACH, True
            l_Msg.Save
            oPA.SetProperty PR_ATTACHMENT_HIDDEN, True
            l_Msg.Save
            MsgBox oPA.GetProperty(PR_HIDE_ATTACH) & " - " & oPA.GetProperty(PR_ATTACHMENT_HIDDEN)

my message box for each attachment in the loop displays "True - False" , even though I had set the namespace property to 'True' for both and saved the email message before displaying the property's value?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
Grrrr.... I work it out!

It's because Outlook 2007 onwards sucks and isn't HTML compatible.

The inline images were being used within the inline CSS file, and some are background, and I just remembered that MS are no longer capable of making a HTML compatible email client.

So any background image or other types of CSS is ignored, removed, or what ever it is MS is doing, either way Outlook 2007 onwards doesn't work and is not HTML/CSS compatible.

Well there's a day of my life i'll never get back!

Not to mention now a total rewrite of the email HTML markup has to be done just to make it semi compatible with Outlook!

I'll never get the email to look how it's meant to because Outlook isn't CSS / X/HTML compaitble and so no background images can be used!

I wan't to go back to 2003, it was a great year for comupters and Microsoft, because everything used to work!

Talk about barking up the wrong tree though, took me a while, but finally worked out why it wasn't working, so the initial conclusion I guess is right.

MSO2010 doesn't work properly. :p

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
>either way Outlook 2007 onwards doesn't work and is not HTML/CSS compatible

Ah. Yes. As of Outlook 2007 MS decided to change the HTML rendering engine; it no longer relies on IE's engine but instead uses a version of the Word 2007 HTML rendering engine - which is somewhat crippled ...
 
Thanks strongm,

Why on earth would MS decide to use the worst ever HTML parsing software on the planet to render HTML?

It's a known fact since Word was invented; it doesn't do HTML?

Never has and by the looks of things never will!

I've had to change my email to just be plain text style HTML with just a logo embeded with an img tag, i have better things to do with my life than fix stuff I didn't break!

Just as MS start bringing out web browsers that actually works, are resonably secure and W3C standards compliant , they use a POS word engine to handle emails in their email client.

Did aliens abduct all the intelligent people at MS and replace them with chimps?




"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
I've written an FAQ which hopefully will help others with this headache faq705-7446


"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top