A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Chaning MessageClass with Preview Pane



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 22nd 09, 11:15 PM posted to microsoft.public.outlook.program_addins
dmjames
external usenet poster
 
Posts: 3
Default Chaning MessageClass with Preview Pane

I'm trying to change MessageClass when an item is opened so as to open a
custom form. My code works fine when the Preview Pane is closed; it doesn't
work when the pane is open. I've tried changing the form, clearing forms
cache, etc.; I'm sure it's not a form problem. I've tested and tried it many
times -- the behavior is that it works when Preview Pane is closed, and opens
the default IPM.Note when the Preview Pane is open. (If anyone is curious,
my ultimate goal is to provide a preview tab where all text in the message is
changed to an easy-to-read font, but not change the message permanently.)

Here's my code:

'CONNECTION CODE

Option Explicit

Dim WithEvents objInsps As Outlook.Inspectors

Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal
ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As
Object, custom() As Variant)
Set objInsps = Application.Inspectors
AddInInst.object = Me
End Sub

Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode As
AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
Set objInsps = Nothing
End Sub


Private Sub objInsps_NewInspector(ByVal currInsp As Inspector)
Dim ci As New clsInspectors
If currInsp.CurrentItem.Class = olMail Then
If currInsp.CurrentItem.MessageClass = "IPM.Note" Or
currInsp.CurrentItem.MessageClass = "IPM.Note.Preview" Then
If currInsp.CurrentItem.EntryID vbNullString Then 'Sent
Set ci = InspColl.Add(currInsp,
currInsp.CurrentItem.entryid) 'collection of clsInspectors
ci.IID = currInsp.CurrentItem.EntryID
ci.FirstActivation = True
End If
End If
End If
End Sub

'CLSINSPECTORS

Option Explicit

Public WithEvents currInsp As Inspector
Public IID As String
Public FirstActivation As Boolean

Private Sub currInsp_Activate()
If FirstActivation Then
currInsp.CurrentItem.MessageClass = "IPM.Note.Preview"
currInsp.CurrentItem.Save
'The custom form contains a preview control on a tab called Preview,
which I populate here
'If the preview pane of the explorer from which I opened the item is
visible, currInsp.ModifiedFormPages("Preview") returns Nothing
FirstActivation = False
End If
End Sub

Private Sub currInsp_Close()
currInsp.CurrentItem.MessageClass = "IPM.Note"
currInsp.CurrentItem.Save
InspColl.Remove IID
End Sub

Thanks,

Dave James
Ads
  #2  
Old May 22nd 09, 11:17 PM posted to microsoft.public.outlook.program_addins
dmjames
external usenet poster
 
Posts: 3
Default Chaning MessageClass with Preview Pane

Forgot to mention, OL2003 SP3.

"dmjames" wrote:

I'm trying to change MessageClass when an item is opened so as to open a
custom form. My code works fine when the Preview Pane is closed; it doesn't
work when the pane is open. I've tried changing the form, clearing forms
cache, etc.; I'm sure it's not a form problem. I've tested and tried it many
times -- the behavior is that it works when Preview Pane is closed, and opens
the default IPM.Note when the Preview Pane is open. (If anyone is curious,
my ultimate goal is to provide a preview tab where all text in the message is
changed to an easy-to-read font, but not change the message permanently.)

Here's my code:

'CONNECTION CODE

Option Explicit

Dim WithEvents objInsps As Outlook.Inspectors

Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal
ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As
Object, custom() As Variant)
Set objInsps = Application.Inspectors
AddInInst.object = Me
End Sub

Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode As
AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
Set objInsps = Nothing
End Sub


Private Sub objInsps_NewInspector(ByVal currInsp As Inspector)
Dim ci As New clsInspectors
If currInsp.CurrentItem.Class = olMail Then
If currInsp.CurrentItem.MessageClass = "IPM.Note" Or
currInsp.CurrentItem.MessageClass = "IPM.Note.Preview" Then
If currInsp.CurrentItem.EntryID vbNullString Then 'Sent
Set ci = InspColl.Add(currInsp,
currInsp.CurrentItem.entryid) 'collection of clsInspectors
ci.IID = currInsp.CurrentItem.EntryID
ci.FirstActivation = True
End If
End If
End If
End Sub

'CLSINSPECTORS

Option Explicit

Public WithEvents currInsp As Inspector
Public IID As String
Public FirstActivation As Boolean

Private Sub currInsp_Activate()
If FirstActivation Then
currInsp.CurrentItem.MessageClass = "IPM.Note.Preview"
currInsp.CurrentItem.Save
'The custom form contains a preview control on a tab called Preview,
which I populate here
'If the preview pane of the explorer from which I opened the item is
visible, currInsp.ModifiedFormPages("Preview") returns Nothing
FirstActivation = False
End If
End Sub

Private Sub currInsp_Close()
currInsp.CurrentItem.MessageClass = "IPM.Note"
currInsp.CurrentItem.Save
InspColl.Remove IID
End Sub

Thanks,

Dave James

  #3  
Old May 26th 09, 04:24 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Chaning MessageClass with Preview Pane

NewInspector() won't help you at all for the preview pane, that's for items
that are being opened, not previewed. You need to handle
Explorer.SelectionChange() for the ActiveExplorer to know what is now
selected and in the preview pane. You would work with the Selection
collection.

Previewing custom forms in the preview pane won't work though, they are
blocked from previewing. You could change the MessageClass and save the item
to preserve the change, but for a custom form you'd just end up with the
preview pane showing the "can't show this message" warning.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"dmjames" wrote in message
...
Forgot to mention, OL2003 SP3.

"dmjames" wrote:

I'm trying to change MessageClass when an item is opened so as to open a
custom form. My code works fine when the Preview Pane is closed; it
doesn't
work when the pane is open. I've tried changing the form, clearing forms
cache, etc.; I'm sure it's not a form problem. I've tested and tried it
many
times -- the behavior is that it works when Preview Pane is closed, and
opens
the default IPM.Note when the Preview Pane is open. (If anyone is
curious,
my ultimate goal is to provide a preview tab where all text in the
message is
changed to an easy-to-read font, but not change the message permanently.)

Here's my code:

'CONNECTION CODE

Option Explicit

Dim WithEvents objInsps As Outlook.Inspectors

Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal
ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As
Object, custom() As Variant)
Set objInsps = Application.Inspectors
AddInInst.object = Me
End Sub

Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode As
AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
Set objInsps = Nothing
End Sub


Private Sub objInsps_NewInspector(ByVal currInsp As Inspector)
Dim ci As New clsInspectors
If currInsp.CurrentItem.Class = olMail Then
If currInsp.CurrentItem.MessageClass = "IPM.Note" Or
currInsp.CurrentItem.MessageClass = "IPM.Note.Preview" Then
If currInsp.CurrentItem.EntryID vbNullString Then 'Sent
Set ci = InspColl.Add(currInsp,
currInsp.CurrentItem.entryid) 'collection of clsInspectors
ci.IID = currInsp.CurrentItem.EntryID
ci.FirstActivation = True
End If
End If
End If
End Sub

'CLSINSPECTORS

Option Explicit

Public WithEvents currInsp As Inspector
Public IID As String
Public FirstActivation As Boolean

Private Sub currInsp_Activate()
If FirstActivation Then
currInsp.CurrentItem.MessageClass = "IPM.Note.Preview"
currInsp.CurrentItem.Save
'The custom form contains a preview control on a tab called
Preview,
which I populate here
'If the preview pane of the explorer from which I opened the item
is
visible, currInsp.ModifiedFormPages("Preview") returns Nothing
FirstActivation = False
End If
End Sub

Private Sub currInsp_Close()
currInsp.CurrentItem.MessageClass = "IPM.Note"
currInsp.CurrentItem.Save
InspColl.Remove IID
End Sub

Thanks,

Dave James


  #4  
Old May 27th 09, 04:58 PM posted to microsoft.public.outlook.program_addins
dmjames
external usenet poster
 
Posts: 3
Default Chaning MessageClass with Preview Pane

Thanks for the info, but maybe I wasn't completely clear. What I want to do
is change MessageClass when an item is opened and change it back when it's
closed. I don't care about the Preview Pane, except that when it's open it
appears to "lock" the item in some way and prevent the custom form from being
used. If I close the Preview Pane my code works as expected, but it should
work whether or not the Preview Pane is open.

Given this, is trapping SelectionChange() still the answer or is there
another way to "unlock" the item being opened?

Thanks again,

Dave James

"Ken Slovak - [MVP - Outlook]" wrote:

NewInspector() won't help you at all for the preview pane, that's for items
that are being opened, not previewed. You need to handle
Explorer.SelectionChange() for the ActiveExplorer to know what is now
selected and in the preview pane. You would work with the Selection
collection.

Previewing custom forms in the preview pane won't work though, they are
blocked from previewing. You could change the MessageClass and save the item
to preserve the change, but for a custom form you'd just end up with the
preview pane showing the "can't show this message" warning.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"dmjames" wrote in message
...
Forgot to mention, OL2003 SP3.

"dmjames" wrote:

I'm trying to change MessageClass when an item is opened so as to open a
custom form. My code works fine when the Preview Pane is closed; it
doesn't
work when the pane is open. I've tried changing the form, clearing forms
cache, etc.; I'm sure it's not a form problem. I've tested and tried it
many
times -- the behavior is that it works when Preview Pane is closed, and
opens
the default IPM.Note when the Preview Pane is open. (If anyone is
curious,
my ultimate goal is to provide a preview tab where all text in the
message is
changed to an easy-to-read font, but not change the message permanently.)

Here's my code:

'CONNECTION CODE

Option Explicit

Dim WithEvents objInsps As Outlook.Inspectors

Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal
ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As
Object, custom() As Variant)
Set objInsps = Application.Inspectors
AddInInst.object = Me
End Sub

Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode As
AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
Set objInsps = Nothing
End Sub


Private Sub objInsps_NewInspector(ByVal currInsp As Inspector)
Dim ci As New clsInspectors
If currInsp.CurrentItem.Class = olMail Then
If currInsp.CurrentItem.MessageClass = "IPM.Note" Or
currInsp.CurrentItem.MessageClass = "IPM.Note.Preview" Then
If currInsp.CurrentItem.EntryID vbNullString Then 'Sent
Set ci = InspColl.Add(currInsp,
currInsp.CurrentItem.entryid) 'collection of clsInspectors
ci.IID = currInsp.CurrentItem.EntryID
ci.FirstActivation = True
End If
End If
End If
End Sub

'CLSINSPECTORS

Option Explicit

Public WithEvents currInsp As Inspector
Public IID As String
Public FirstActivation As Boolean

Private Sub currInsp_Activate()
If FirstActivation Then
currInsp.CurrentItem.MessageClass = "IPM.Note.Preview"
currInsp.CurrentItem.Save
'The custom form contains a preview control on a tab called
Preview,
which I populate here
'If the preview pane of the explorer from which I opened the item
is
visible, currInsp.ModifiedFormPages("Preview") returns Nothing
FirstActivation = False
End If
End Sub

Private Sub currInsp_Close()
currInsp.CurrentItem.MessageClass = "IPM.Note"
currInsp.CurrentItem.Save
InspColl.Remove IID
End Sub

Thanks,

Dave James



  #5  
Old May 27th 09, 06:36 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Chaning MessageClass with Preview Pane

I don't know about the item being locked, I've never run into that. But
SelectionChange() is still the only way to know when a selection is changed
and to what.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"dmjames" wrote in message
...
Thanks for the info, but maybe I wasn't completely clear. What I want to
do
is change MessageClass when an item is opened and change it back when it's
closed. I don't care about the Preview Pane, except that when it's open
it
appears to "lock" the item in some way and prevent the custom form from
being
used. If I close the Preview Pane my code works as expected, but it
should
work whether or not the Preview Pane is open.

Given this, is trapping SelectionChange() still the answer or is there
another way to "unlock" the item being opened?

Thanks again,

Dave James


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Preview pane Koeni Outlook - Using Forms 1 January 16th 08 07:47 PM
Outlook Express 6 Message Panes, Lists Pane and Preview Pane brett Outlook Express 5 October 5th 07 02:20 AM
Preview pane won't go away efg Outlook Express 2 January 5th 07 07:39 PM
Preview Pane (Read Pane) Jack-PEC Outlook - Installation 3 November 16th 06 02:40 PM
No pic in preview pane Ted Outlook Express 4 July 15th 06 03:21 PM


All times are GMT +1. The time now is 09:06 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.