Question

I am about to embark on my first outlook 2007 plugin.

I would like to create a new tool bar that will have a button that will initially be disabled.

When the user selects a message the button should be enabled... but only if the email is of a certain type of email...

This is where I need your expert advice, is there a way to quickly flag an email in outlook, so that in the email select event you can look for a property of that email...

for example...

on_select if mail.type = "FromISP" then

I would prefer not to use the from field....

the other thing is during the send process I need to set the flag, I am doing this again using .net so I have full control over how the mail is created.

Any ideas would help...

Thanks

Was it helpful?

Solution

You can wire up the on Application.ActiveExplorer().SelectionChange event, then look at the items in that collection (as the user may select more that one object). If you just want to enable your button only when one item is selected test for it, also if you just want to track Mail messages test for the MessageClass. Then cast the item into a MailItem where you can see all it properties.

For the send use Application.ItemSend event i think it will do the job .. (I tend to wrap the inspector my self.. ) You can then set your "flag" here. Setting a flag .. I would suggest using a userproperty on the item.

Update

On the send event add a userproperty to the email.

    UserProperty myprop = myItem.UserProperties.Add("MyPropName", olText);
    myprop.Value = "FlagOn" ;

Then in your selection event test for your flag by looking up the userproperty. Many people use the Mileage or Billing Fields of the Mailitem to store flags its simple but, if you run other addins or forms you find that they may use them as well and cause problems.

Update 2

Ok ... I think the way to go would be to add an X header in the ASP generation code then test for that looking at the email headers in your Addin using property accessors.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top