Active content in preview pane - solved

K

kristan.mcdonald

Ok, finally managed to get this working, you can have as much code etc.
in your custom form as you want, but STILL have it display properly in
the preview pane.

Basically there's a CDO property (0x8002) which controls whether
outlook should render the preview pane or not. When sending the message
with the custom code, if you set this to zero, when received your mail
will render in the preview pane correctly.

It was a bit tricky to get working, in the end I had to write an addin
to watch for send events with the message class matching my own and
then do the following (in the current mail send event):

If objCurMail.MessageClass = "IPM.Note.MyMessageClass" Then
On Error Resume Next
Dim objCDOMail As MAPI.Message

objCurMail.Save 'Need to save to get an entryID

Dim strEntryID
Dim strStoreID
strEntryID = objCurMail.EntryID
strStoreID = objCurMail.Parent.StoreID
'Get the mail via CDO
Set objCDOMail = gobjCDO.Session.GetMessage(strEntryID,
strStoreID)

If Not objCDOMail Is Nothing Then
'We've got our mail, set the property
objCDOMail.Fields.Add -2147352573, 0, 0,
"2903020000000000C000000000000046"
'Update the mail
objCDOMail.Update True
End If

'Send it via CDO
objCDOMail.Send
'Use our addin to close the mail and the inspector
objCurMail.Close (olSave)
objCurInsp.Close (olSave)

Set objCDOMail = Nothing
Set objCurMail = Nothing
End If


Now I'm no Outlook programming guru, so this can probably be tidied up
lots and tested further, but now when I send an email, it arrives and
the preview pane works - and I need to get the rest of the development
finished now!

Feel free to email if you have any comments/suggestions, I hope this is
helpful to someone!

Kristan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top