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

RibbonDropDown selecteditem depending on ItemProperty.



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 28th 10, 12:11 AM posted to microsoft.public.outlook.program_addins
Chris
external usenet poster
 
Posts: 280
Default RibbonDropDown selecteditem depending on ItemProperty.

Hi,

I have a RibbonDropDown with 10 values. This RibbonDropDown is placed inside
a Ribbon (designer). This Ribbon is set to display on Mail.Read in the
Message tab. When I open an email I need to get the value of an ItemProperty
of the current Inspector (the MailItem I am opening) and set a default value
in the RibbonDropDown. Setting the default value is not the problem. What I
am having trouble with is placing the code in the right place. I tried to do
it on the Activate event for the current Inspector but that seems to fire
only when I set the current window to the active window, not when I open the
email. I also tried when a new inspector is created, but that doesn't work
either.

How can I achieve this?

Thanks for the help.


Ads
  #2  
Old March 29th 10, 03:24 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default RibbonDropDown selecteditem depending on ItemProperty.

The first Activate() event is the correct place for your code. Before that
the item properties and Inspector properties aren't fully filled in (you
have weak object references). When you open an item it will always fire an
Activate() event, use that.

--
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


"chris" wrote in message
...
Hi,

I have a RibbonDropDown with 10 values. This RibbonDropDown is placed
inside
a Ribbon (designer). This Ribbon is set to display on Mail.Read in the
Message tab. When I open an email I need to get the value of an
ItemProperty
of the current Inspector (the MailItem I am opening) and set a default
value
in the RibbonDropDown. Setting the default value is not the problem. What
I
am having trouble with is placing the code in the right place. I tried to
do
it on the Activate event for the current Inspector but that seems to fire
only when I set the current window to the active window, not when I open
the
email. I also tried when a new inspector is created, but that doesn't work
either.

How can I achieve this?

Thanks for the help.



  #3  
Old March 29th 10, 05:40 PM posted to microsoft.public.outlook.program_addins
Chris
external usenet poster
 
Posts: 280
Default RibbonDropDown selecteditem depending on ItemProperty.

Thanks for the reply!

I have tried putting the code in the Activate event handler, but I can see
the item selected only on the rest of the of the times when the Activate is
executed, not on the first one. Am I not picking up the Current Inspector
correctly?

void Inspector_Activate()
{
Outlook.MailItem email =
(Outlook.MailItem)Globals.ThisAddIn.ActiveInspecto r().CurrentItem;
Outlook.ItemProperty item =
(Outlook.ItemProperty)email.ItemProperties["myId"];
if(item != null)
{
// code here
}
}


Thanks!




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

The first Activate() event is the correct place for your code. Before that
the item properties and Inspector properties aren't fully filled in (you
have weak object references). When you open an item it will always fire an
Activate() event, use that.

--
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


"chris" wrote in message
...
Hi,

I have a RibbonDropDown with 10 values. This RibbonDropDown is placed
inside
a Ribbon (designer). This Ribbon is set to display on Mail.Read in the
Message tab. When I open an email I need to get the value of an
ItemProperty
of the current Inspector (the MailItem I am opening) and set a default
value
in the RibbonDropDown. Setting the default value is not the problem. What
I
am having trouble with is placing the code in the right place. I tried to
do
it on the Activate event for the current Inspector but that seems to fire
only when I set the current window to the active window, not when I open
the
email. I also tried when a new inspector is created, but that doesn't work
either.

How can I achieve this?

Thanks for the help.



.

  #4  
Old March 29th 10, 07:02 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default RibbonDropDown selecteditem depending on ItemProperty.

You should be handling Inspectors.NewInspector() and instantiating an
Activate() handler for that new Inspector. Why are you then getting
ActiveInspector() which most likely will not point where you want until
after the Activate() event fires?

--
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


"chris" wrote in message
...
Thanks for the reply!

I have tried putting the code in the Activate event handler, but I can see
the item selected only on the rest of the of the times when the Activate
is
executed, not on the first one. Am I not picking up the Current Inspector
correctly?

void Inspector_Activate()
{
Outlook.MailItem email =
(Outlook.MailItem)Globals.ThisAddIn.ActiveInspecto r().CurrentItem;
Outlook.ItemProperty item =
(Outlook.ItemProperty)email.ItemProperties["myId"];
if(item != null)
{
// code here
}
}


Thanks!


 




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
Why will this code just change subject to only the fist selecteditem? ExcelLars Outlook and VBA 11 May 22nd 08 12:21 AM
ListBox SelectedItem to TextBox JP Outlook - Using Forms 1 August 1st 07 02:42 PM
Multivalue MeetingItem.ItemProperty zznw4m Outlook and VBA 1 July 6th 07 07:20 PM
Automatic choose FROM depending on TO Stefan Eder Outlook - General Queries 1 March 2nd 06 12:43 AM
different signatures depending on the e-mail account Nader Outlook - General Queries 1 January 18th 06 05:22 PM


All times are GMT +1. The time now is 11:43 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.