Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: Strange Subject Line Behavior

Geek News

Strange Subject Line Behavior
gwolinsky[ at ]millermartin.com 8/11/2006 8:22:24 PM
I have run across a strange problem. I have created a simple Outlook
2003 Add-in using VSTO in VS2005.

When a new mail message inspector is opened, I add a button to the
inspector's command bar. This button simply appends some standard text
on the end of whatever subject line text is already there if it has not
already been done. I check to see if the standardized text is on the
end of subject. If it's not, I add it.

It's really rather simple and works great (even with multiple
inspectors open) except for one strange issue.

When I enter some text in the subject line, if I DON'T exit the subject
textbox, whatever text I've entered doesn't show up in the mail message
object. So, when I go to add the standard text, whatever text I've
already keyed isn't there and my code erases it when it resets the
subject textbox.

If I key in some text and EXIT the subject textbox, then, when I click
the button, the mail object sees the text just fine and appends the
standard text to it as it should.

Has anyone else seen this behavior? It seems that the text in the
subject line textbox is not available to the mail message object until
you exit the field.

Any help or information would be greatly appreciated.

Sincerely,
Glen Wolinsky

Code Below
---------------------------
Public Class ThisApplication

Const PRIV_TEXT As String = " - Confidential Attorney Work Product
- Subject to Privilege"
Private WithEvents confidentialButton As Office.CommandBarButton
Private WithEvents olInspectors As Outlook.Inspectors =
Me.Inspectors


Private Sub ThisApplication_Startup(ByVal sender As Object, ByVal e
As System.EventArgs) Handles Me.Startup


End Sub

Private Sub ThisApplication_Shutdown(ByVal sender As Object, ByVal
e As System.EventArgs) Handles Me.Shutdown

End Sub

Private Sub NewInspector(ByVal insp As Outlook.Inspector) Handles
olInspectors.NewInspector

If TypeOf (insp.CurrentItem) Is Outlook.MailItem Then
Dim bar As Office.CommandBar = insp.CommandBars("Standard")

confidentialButton =
bar.Controls.Add(Office.MsoControlType.msoControlButton,
Temporary:=True)
With confidentialButton
.Caption = "Privilaged Tag"
.Style = MsoButtonStyle.msoButtonCaption
AddHandler .Click, AddressOf confidentialButton_Click
End With

End If

End Sub


Private Sub confidentialButton_Click(ByVal Ctrl As
Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As Boolean)

Dim draft As Outlook.MailItem =
DirectCast(ActiveInspector.CurrentItem, Outlook.MailItem)

If Not draft.Subject.EndsWith(PRIV_TEXT) Then
draft.Subject = Trim(draft.Subject) & PRIV_TEXT
End If


End Sub


End Class

Re: Strange Subject Line Behavior
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 8/13/2006 5:44:18 PM
The control doesn't post the text until it loses focus.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


<gwolinsky[ at ]millermartin.com> wrote in message
news:1155327744.143424.162030[ at ]75g2000cwc.googlegroups.com...
[Quoted Text]
>I have run across a strange problem. I have created a simple Outlook
> 2003 Add-in using VSTO in VS2005.
>
> When a new mail message inspector is opened, I add a button to the
> inspector's command bar. This button simply appends some standard text
> on the end of whatever subject line text is already there if it has not
> already been done. I check to see if the standardized text is on the
> end of subject. If it's not, I add it.
>
> It's really rather simple and works great (even with multiple
> inspectors open) except for one strange issue.
>
> When I enter some text in the subject line, if I DON'T exit the subject
> textbox, whatever text I've entered doesn't show up in the mail message
> object. So, when I go to add the standard text, whatever text I've
> already keyed isn't there and my code erases it when it resets the
> subject textbox.
>
> If I key in some text and EXIT the subject textbox, then, when I click
> the button, the mail object sees the text just fine and appends the
> standard text to it as it should.
>
> Has anyone else seen this behavior? It seems that the text in the
> subject line textbox is not available to the mail message object until
> you exit the field.
>
> Any help or information would be greatly appreciated.
>
> Sincerely,
> Glen Wolinsky
>
> Code Below
> ---------------------------
> Public Class ThisApplication
>
> Const PRIV_TEXT As String = " - Confidential Attorney Work Product
> - Subject to Privilege"
> Private WithEvents confidentialButton As Office.CommandBarButton
> Private WithEvents olInspectors As Outlook.Inspectors =
> Me.Inspectors
>
>
> Private Sub ThisApplication_Startup(ByVal sender As Object, ByVal e
> As System.EventArgs) Handles Me.Startup
>
>
> End Sub
>
> Private Sub ThisApplication_Shutdown(ByVal sender As Object, ByVal
> e As System.EventArgs) Handles Me.Shutdown
>
> End Sub
>
> Private Sub NewInspector(ByVal insp As Outlook.Inspector) Handles
> olInspectors.NewInspector
>
> If TypeOf (insp.CurrentItem) Is Outlook.MailItem Then
> Dim bar As Office.CommandBar = insp.CommandBars("Standard")
>
> confidentialButton =
> bar.Controls.Add(Office.MsoControlType.msoControlButton,
> Temporary:=True)
> With confidentialButton
> .Caption = "Privilaged Tag"
> .Style = MsoButtonStyle.msoButtonCaption
> AddHandler .Click, AddressOf confidentialButton_Click
> End With
>
> End If
>
> End Sub
>
>
> Private Sub confidentialButton_Click(ByVal Ctrl As
> Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As Boolean)
>
> Dim draft As Outlook.MailItem =
> DirectCast(ActiveInspector.CurrentItem, Outlook.MailItem)
>
> If Not draft.Subject.EndsWith(PRIV_TEXT) Then
> draft.Subject = Trim(draft.Subject) & PRIV_TEXT
> End If
>
>
> End Sub
>
>
> End Class
>

Re: Strange Subject Line Behavior
gwolinsky[ at ]millermartin.com 8/14/2006 1:17:08 PM
Is there any way to force that posting in code so as to accept whatever
text has been keyed?

Thanks,
Glen


Ken Slovak - [MVP - Outlook] wrote:
[Quoted Text]
> The control doesn't post the text until it loses focus.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> <gwolinsky[ at ]millermartin.com> wrote in message
> news:1155327744.143424.162030[ at ]75g2000cwc.googlegroups.com...
> >I have run across a strange problem. I have created a simple Outlook
> > 2003 Add-in using VSTO in VS2005.
> >
> > When a new mail message inspector is opened, I add a button to the
> > inspector's command bar. This button simply appends some standard text
> > on the end of whatever subject line text is already there if it has not
> > already been done. I check to see if the standardized text is on the
> > end of subject. If it's not, I add it.
> >
> > It's really rather simple and works great (even with multiple
> > inspectors open) except for one strange issue.
> >
> > When I enter some text in the subject line, if I DON'T exit the subject
> > textbox, whatever text I've entered doesn't show up in the mail message
> > object. So, when I go to add the standard text, whatever text I've
> > already keyed isn't there and my code erases it when it resets the
> > subject textbox.
> >
> > If I key in some text and EXIT the subject textbox, then, when I click
> > the button, the mail object sees the text just fine and appends the
> > standard text to it as it should.
> >
> > Has anyone else seen this behavior? It seems that the text in the
> > subject line textbox is not available to the mail message object until
> > you exit the field.
> >
> > Any help or information would be greatly appreciated.
> >
> > Sincerely,
> > Glen Wolinsky
> >
> > Code Below
> > ---------------------------
> > Public Class ThisApplication
> >
> > Const PRIV_TEXT As String = " - Confidential Attorney Work Product
> > - Subject to Privilege"
> > Private WithEvents confidentialButton As Office.CommandBarButton
> > Private WithEvents olInspectors As Outlook.Inspectors =
> > Me.Inspectors
> >
> >
> > Private Sub ThisApplication_Startup(ByVal sender As Object, ByVal e
> > As System.EventArgs) Handles Me.Startup
> >
> >
> > End Sub
> >
> > Private Sub ThisApplication_Shutdown(ByVal sender As Object, ByVal
> > e As System.EventArgs) Handles Me.Shutdown
> >
> > End Sub
> >
> > Private Sub NewInspector(ByVal insp As Outlook.Inspector) Handles
> > olInspectors.NewInspector
> >
> > If TypeOf (insp.CurrentItem) Is Outlook.MailItem Then
> > Dim bar As Office.CommandBar = insp.CommandBars("Standard")
> >
> > confidentialButton =
> > bar.Controls.Add(Office.MsoControlType.msoControlButton,
> > Temporary:=True)
> > With confidentialButton
> > .Caption = "Privilaged Tag"
> > .Style = MsoButtonStyle.msoButtonCaption
> > AddHandler .Click, AddressOf confidentialButton_Click
> > End With
> >
> > End If
> >
> > End Sub
> >
> >
> > Private Sub confidentialButton_Click(ByVal Ctrl As
> > Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As Boolean)
> >
> > Dim draft As Outlook.MailItem =
> > DirectCast(ActiveInspector.CurrentItem, Outlook.MailItem)
> >
> > If Not draft.Subject.EndsWith(PRIV_TEXT) Then
> > draft.Subject = Trim(draft.Subject) & PRIV_TEXT
> > End If
> >
> >
> > End Sub
> >
> >
> > End Class
> >

Re: Strange Subject Line Behavior
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 8/14/2006 2:07:04 PM
Not that I know of but I've never tried. I'm sure you could do it with
plenty of Win32 API calls and hooking all messages to that rich text
control, a window under the primary email window.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


<gwolinsky[ at ]millermartin.com> wrote in message
news:1155561428.217367.257570[ at ]75g2000cwc.googlegroups.com...
[Quoted Text]
> Is there any way to force that posting in code so as to accept whatever
> text has been keyed?
>
> Thanks,
> Glen

Re: Strange Subject Line Behavior
gwolinsky[ at ]millermartin.com 8/14/2006 4:06:22 PM
Thanks for the info. If I might trouble you further.

This add-in has created a problem. We have a document management
system (MailSite from iManage) that integrates with Outlook 2003. You
can view and manipulate documents in the system from the OL2k3
interface. When you open a doc to view it, it checks it out. If you
haven't edited it, then when you exit OL it checks it back in.

When I load my add-in, that check-in never takes place. I'm assuming
that the problem is related to the known issue for which AddInMon was
created. The AddInMon information mentions using it for OL2k and OL2k2
but do I need this solution for OL2k3?

Thanks,
Glen



Ken Slovak - [MVP - Outlook] wrote:
[Quoted Text]
> Not that I know of but I've never tried. I'm sure you could do it with
> plenty of Win32 API calls and hooking all messages to that rich text
> control, a window under the primary email window.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> <gwolinsky[ at ]millermartin.com> wrote in message
> news:1155561428.217367.257570[ at ]75g2000cwc.googlegroups.com...
> > Is there any way to force that posting in code so as to accept whatever
> > text has been keyed?
> >
> > Thanks,
> > Glen

Re: Strange Subject Line Behavior
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 8/14/2006 10:17:07 PM
Outlook 2003 has the same problems. Outlook 2007 seems to finally have fixed
that bug.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


<gwolinsky[ at ]millermartin.com> wrote in message
news:1155571582.461161.230820[ at ]i42g2000cwa.googlegroups.com...
[Quoted Text]
> Thanks for the info. If I might trouble you further.
>
> This add-in has created a problem. We have a document management
> system (MailSite from iManage) that integrates with Outlook 2003. You
> can view and manipulate documents in the system from the OL2k3
> interface. When you open a doc to view it, it checks it out. If you
> haven't edited it, then when you exit OL it checks it back in.
>
> When I load my add-in, that check-in never takes place. I'm assuming
> that the problem is related to the known issue for which AddInMon was
> created. The AddInMon information mentions using it for OL2k and OL2k2
> but do I need this solution for OL2k3?
>
> Thanks,
> Glen

Re: Strange Subject Line Behavior
gwolinsky[ at ]millermartin.com 8/15/2006 1:30:23 PM
I have been trying to work through using AddInMon, but have not been
able to get it to work yet. The code included in the examples look
like VB6. Has anyone done this in VB.NET using VS2k5? I'm a beginner
with Outlook programming and seem to be in a bit over my head.

Should I be looking at modifying the main email form instead?

Thanks,
Glen


Ken Slovak - [MVP - Outlook] wrote:
[Quoted Text]
> Outlook 2003 has the same problems. Outlook 2007 seems to finally have fixed
> that bug.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> <gwolinsky[ at ]millermartin.com> wrote in message
> news:1155571582.461161.230820[ at ]i42g2000cwa.googlegroups.com...
> > Thanks for the info. If I might trouble you further.
> >
> > This add-in has created a problem. We have a document management
> > system (MailSite from iManage) that integrates with Outlook 2003. You
> > can view and manipulate documents in the system from the OL2k3
> > interface. When you open a doc to view it, it checks it out. If you
> > haven't edited it, then when you exit OL it checks it back in.
> >
> > When I load my add-in, that check-in never takes place. I'm assuming
> > that the problem is related to the known issue for which AddInMon was
> > created. The AddInMon information mentions using it for OL2k and OL2k2
> > but do I need this solution for OL2k3?
> >
> > Thanks,
> > Glen

Re: Strange Subject Line Behavior
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 8/15/2006 6:14:22 PM
AddInMon was written in VB 6. To my knowledge there have been no
translations into any other language, and we're not planning to update it
further. We've come up with an inline alternative to AddInMon (VB 6 only at
this point) that does better than AddInMon in handling all the variations
that come with different Outlook versions and ways Outlook starts with no
UI.

The inline replacement has not been released yet. I'm adapting it to VB.NET
and C# and plan to release the templates in conjunction with my Outlook 2007
programming book (although parenthetically Outlook 2007 solves the
OnDisconnection won't fire problem).

My opinion is that I avoid the use of custom forms unless they are
absolutely necessary. Custom forms are a less than robust solution and are
prone to forms cache corruption and various other problems. In all cases,
unless my client drags me there kicking and screaming, I do everything in
COM addins and avoid forms like the plague. Your mileage might vary.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


<gwolinsky[ at ]millermartin.com> wrote in message
news:1155648623.572936.44440[ at ]i3g2000cwc.googlegroups.com...
[Quoted Text]
>I have been trying to work through using AddInMon, but have not been
> able to get it to work yet. The code included in the examples look
> like VB6. Has anyone done this in VB.NET using VS2k5? I'm a beginner
> with Outlook programming and seem to be in a bit over my head.
>
> Should I be looking at modifying the main email form instead?
>
> Thanks,
> Glen

Re: Strange Subject Line Behavior
gwolinsky[ at ]millermartin.com 8/15/2006 6:41:46 PM
Ken,

Your response begs the question: When do you plan on your Outlook 2007
book coming out? Or, is it possible to get your inline adaptation any
sooner?

We will not be going to OL2k7 for quite some time and some of our
attorneys REALLY want this feature.

Thanks,
Glen


Ken Slovak - [MVP - Outlook] wrote:
[Quoted Text]
> AddInMon was written in VB 6. To my knowledge there have been no
> translations into any other language, and we're not planning to update it
> further. We've come up with an inline alternative to AddInMon (VB 6 only at
> this point) that does better than AddInMon in handling all the variations
> that come with different Outlook versions and ways Outlook starts with no
> UI.
>
> The inline replacement has not been released yet. I'm adapting it to VB.NET
> and C# and plan to release the templates in conjunction with my Outlook 2007
> programming book (although parenthetically Outlook 2007 solves the
> OnDisconnection won't fire problem).
>
> My opinion is that I avoid the use of custom forms unless they are
> absolutely necessary. Custom forms are a less than robust solution and are
> prone to forms cache corruption and various other problems. In all cases,
> unless my client drags me there kicking and screaming, I do everything in
> COM addins and avoid forms like the plague. Your mileage might vary.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> <gwolinsky[ at ]millermartin.com> wrote in message
> news:1155648623.572936.44440[ at ]i3g2000cwc.googlegroups.com...
> >I have been trying to work through using AddInMon, but have not been
> > able to get it to work yet. The code included in the examples look
> > like VB6. Has anyone done this in VB.NET using VS2k5? I'm a beginner
> > with Outlook programming and seem to be in a bit over my head.
> >
> > Should I be looking at modifying the main email form instead?
> >
> > Thanks,
> > Glen

Re: Strange Subject Line Behavior
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 8/15/2006 8:28:44 PM
My book will probably be released around the end of the year, about when
Outlook 2007 is released.

As I said, I don't plan to release the inline templates for VB/VB.NET/C#
until the book comes out.

AddInMon still works in most scenarios and can be used as is and downloaded
from the Microeye Web site. The calls to AddInMon use VB 6 code but there's
nothing to stop you from translating those calls into VB.Net or other
language of your choice. The source for that is only a few lines and the
source is available.

AddInMon is only available as an EXE and the source is filled with Win32 API
calls that wouldn't really translate into .NET code anyway.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


<gwolinsky[ at ]millermartin.com> wrote in message
news:1155667306.452626.149810[ at ]h48g2000cwc.googlegroups.com...
[Quoted Text]
> Ken,
>
> Your response begs the question: When do you plan on your Outlook 2007
> book coming out? Or, is it possible to get your inline adaptation any
> sooner?
>
> We will not be going to OL2k7 for quite some time and some of our
> attorneys REALLY want this feature.
>
> Thanks,
> Glen

Re: Strange Subject Line Behavior
gwolinsky[ at ]millermartin.com 8/16/2006 12:59:23 PM
Does anyone out there have an example of implementation of AddInMon in
VSTO 2005 with Outlook 2003? I just haven't been able to figure this
out.

Thanks,
Glen

gwolinsky[ at ]millermartin.com wrote:
[Quoted Text]
> I have run across a strange problem. I have created a simple Outlook
> 2003 Add-in using VSTO in VS2005.
>
> When a new mail message inspector is opened, I add a button to the
> inspector's command bar. This button simply appends some standard text
> on the end of whatever subject line text is already there if it has not
> already been done. I check to see if the standardized text is on the
> end of subject. If it's not, I add it.
>
> It's really rather simple and works great (even with multiple
> inspectors open) except for one strange issue.
>
> When I enter some text in the subject line, if I DON'T exit the subject
> textbox, whatever text I've entered doesn't show up in the mail message
> object. So, when I go to add the standard text, whatever text I've
> already keyed isn't there and my code erases it when it resets the
> subject textbox.
>
> If I key in some text and EXIT the subject textbox, then, when I click
> the button, the mail object sees the text just fine and appends the
> standard text to it as it should.
>
> Has anyone else seen this behavior? It seems that the text in the
> subject line textbox is not available to the mail message object until
> you exit the field.
>
> Any help or information would be greatly appreciated.
>
> Sincerely,
> Glen Wolinsky
>
> Code Below
> ---------------------------
> Public Class ThisApplication
>
> Const PRIV_TEXT As String = " - Confidential Attorney Work Product
> - Subject to Privilege"
> Private WithEvents confidentialButton As Office.CommandBarButton
> Private WithEvents olInspectors As Outlook.Inspectors =
> Me.Inspectors
>
>
> Private Sub ThisApplication_Startup(ByVal sender As Object, ByVal e
> As System.EventArgs) Handles Me.Startup
>
>
> End Sub
>
> Private Sub ThisApplication_Shutdown(ByVal sender As Object, ByVal
> e As System.EventArgs) Handles Me.Shutdown
>
> End Sub
>
> Private Sub NewInspector(ByVal insp As Outlook.Inspector) Handles
> olInspectors.NewInspector
>
> If TypeOf (insp.CurrentItem) Is Outlook.MailItem Then
> Dim bar As Office.CommandBar = insp.CommandBars("Standard")
>
> confidentialButton =
> bar.Controls.Add(Office.MsoControlType.msoControlButton,
> Temporary:=True)
> With confidentialButton
> .Caption = "Privilaged Tag"
> .Style = MsoButtonStyle.msoButtonCaption
> AddHandler .Click, AddressOf confidentialButton_Click
> End With
>
> End If
>
> End Sub
>
>
> Private Sub confidentialButton_Click(ByVal Ctrl As
> Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As Boolean)
>
> Dim draft As Outlook.MailItem =
> DirectCast(ActiveInspector.CurrentItem, Outlook.MailItem)
>
> If Not draft.Subject.EndsWith(PRIV_TEXT) Then
> draft.Subject = Trim(draft.Subject) & PRIV_TEXT
> End If
>
>
> End Sub
>
>
> End Class

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net