How do I put a button or menu item on the mail item screen in Outlook 2002?

Add-in Express™ Support Service
That's what is more important than anything else

How do I put a button or menu item on the mail item screen in Outlook 2002?
How do I put a button or menu item on the mail item screen in Outlook 2002? 
Jeff Gallant


Guest


I'm a new user (we bought Add-in Express yesterday) and I'm trying to put something (a button or menu item, I don't really mind which) on the screen you get when you open an email in Outlook 2002 so I can offer the user some processing at that point.

I've tried adxContextMenu but that doesn't seem to work for me.

How can I do this?

Best wishes

Jeff
Posted 01 Nov, 2011 05:31:14 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello Jeff,

Thank you for choosing Add-in Express.

When you open an email, the window containig the email is an Outlook inspector. In Outlook 2002, you can add a button to the Outlook inspector in two ways:
- create a custom command bar as shown in the manual, see the section Step #8 ?Â?Ð?ã Adding a New Inspector Command Bar
- or, you can create a custom pane and put the button onto the pane; this is described in Step #15 ?Â?Ð?ã Adding Custom Task Panes in Outlook 2000-2010

TadxContextMenu adds an item to a context menu. But not all of the context menus that you see in Outlook are available for customizing and that context menu is not customizable.


Andrei Smolin
Add-in Express Team Leader
Posted 01 Nov, 2011 11:58:01 Top
Jeff Gallant


Guest


Andrei

Thank you for your prompt reply. I used the Inspector Command Bar. It's easy when you know how!!!

Now that I've got there, I'm trying to access various parts of a message.

In the examples, I've noticed code like:
Result := OleVariant(ISelection.Item(1)).Body; and
Result := OleVariant(ISelection.Item(1)).Subject;

I worked out I could get the sender's name by

Result := OleVariant(ISelection.Item(1)).SenderName;

However, I get an error when I try

Result := OleVariant(ISelection.Item(1)).SenderEmailAddress;

even though the documention I've looked at has SenderEmailAddress as a property of the MailItem object.

I've tried being more explicit with

Result := MailItem(ISelection.Item(1)).SenderEmailAddress;

but that doesn't help.

Is there a (better) way of getting the sender's email address from a mail item?

Best wishes

Jeff

(London GMT)
Posted 02 Nov, 2011 10:55:20 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Jeff,

Result := OleVariant(ISelection.Item(1)).SenderEmailAddress;

This can produce errors in the following scenarios:
- the selection doesn't contains any items (ISelection.Count returns zero)
- the selected item doesn't expose that property

The latter will occur on Outlook 2000. BTW, what Outlook version are you using? It may also occur if you select a non-mail item; this can be verified by checking OleVariant(ISelection.Item(1)).Class - it must be 43 for a mail item, see OlObjectClass.

And just for completeness: do you get a security warning when getting that property?


Andrei Smolin
Add-in Express Team Leader
Posted 02 Nov, 2011 11:11:40 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Oh, I've just noticed you're using Outlook 2002. Then, you don't have that property, it was introduced in Outlook 2003. Please check the suggestions in http://support.microsoft.com/kb/324530.


Andrei Smolin
Add-in Express Team Leader
Posted 02 Nov, 2011 11:13:49 Top
Jeff Gallant


Guest


Andrei

Again, thanks.

I was sure I was looking at the office 2002 object model : either I wasn't or the documentation's wrong.

Thanks for the link. I'll give constructing a dummy reply a go.

Best wishes

Jeff
Posted 02 Nov, 2011 12:13:53 Top