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 » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

multiple ribbons with the same ribbonID



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 15th 06, 02:36 PM posted to microsoft.public.outlook.program_forms
Nikolas
external usenet poster
 
Posts: 34
Default multiple ribbons with the same ribbonID

Hi,

is it possible to have different Ribbons on an Outlook mail item depending
on their message class? I see that the Ribbon is loaded only once when a mail
item is loaded the first time. Whenever you load another mail item the ribbon
stays the same and it just invalidates the controls.

My aim is to have a custom group in different positions on the ribbon
depending on the message class of the mail item.

Thanks in advance
Ads
  #2  
Old November 15th 06, 03:34 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default multiple ribbons with the same ribbonID

The XML is loaded only once per each Inspector type (Mail.Compose,
Mail.Read, etc.).

Your choices probably boil down to creating a huge ribbon with everything
you want everywhere and making various controls visible and invisible
depending on the Inspector, or using one or more dynamicMenu setups where
the XML would be loaded each time and supplied on the fly.

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


"Nikolas" wrote in message
news
Hi,

is it possible to have different Ribbons on an Outlook mail item depending
on their message class? I see that the Ribbon is loaded only once when a
mail
item is loaded the first time. Whenever you load another mail item the
ribbon
stays the same and it just invalidates the controls.

My aim is to have a custom group in different positions on the ribbon
depending on the message class of the mail item.

Thanks in advance


  #3  
Old November 27th 06, 11:11 AM posted to microsoft.public.outlook.program_forms
Nikolas
external usenet poster
 
Posts: 34
Default multiple ribbons with the same ribbonID

Hi Ken,

Thanks for your suggestion (created two custom groups in the ribbon and I
toggle their visibility). Everything looked to work fine apart from an issue
with the refresh of the Ribbon. It looks like the Ribbon doesn't refresh
everytime a new inspector (of the same type (ex. Mail.Compose) is created and
displayed. I put a breakpoint in the callback functions that determine the
visibility of the buttons in the custom Ribbon groups (depending on the
Message Class of the Mail Item) and randomly ignores some calls. I tried
putting calls of the function InvalidateControl("MyRibbonGroupName") to the
function that creates the Inspector but this didnt solve my problem.

Any suggestions would appreciated.

Nikolas

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

The XML is loaded only once per each Inspector type (Mail.Compose,
Mail.Read, etc.).

Your choices probably boil down to creating a huge ribbon with everything
you want everywhere and making various controls visible and invisible
depending on the Inspector, or using one or more dynamicMenu setups where
the XML would be loaded each time and supplied on the fly.

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


"Nikolas" wrote in message
news
Hi,

is it possible to have different Ribbons on an Outlook mail item depending
on their message class? I see that the Ribbon is loaded only once when a
mail
item is loaded the first time. Whenever you load another mail item the
ribbon
stays the same and it just invalidates the controls.

My aim is to have a custom group in different positions on the ribbon
depending on the message class of the mail item.

Thanks in advance



  #4  
Old November 27th 06, 03:21 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default multiple ribbons with the same ribbonID

It's a matter of timing most likely. I've had to deal with two different
timing problems related to ribbons and Inspectors.

The first time an Inspector is instantiated for a ribbon the Ribbon_OnLoad
function hasn't fired yet. So any ribbon references aren't valid. What I do
is set up a dummy Office.IRibbonUI object at module level, knowing it's a
dummy that first time around and will be null (Nothing) until Ribbon_OnLoad
fires.

I have a module level Office.IRibbonUI object in each Inspector wrapper
class that is null for the first Inspector. After that the ribbon object is
valid and the class ribbon object is instantiated when I add the new
Inspector to my wrapper class collection.

In Ribbon_OnLoad I iterate the Inspectors wrapper class collection and
instantiate each ribbon object in each wrapper class.

To take care of the second problem I call the invalidate code in the
Inspector Activate event that fires within my Inspector wrapper class. I can
either call InvalidateControl or if I want everything to be refreshed I can
call Ribbon.Invalidate, which invalidates everything.

See if that helps.

It works in my addin templates for my book. I've used it so far with VB6,
VB.NET, C#, VSTO/VB.NET and VSTO/C# addin templates.

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


"Nikolas" wrote in message
...
Hi Ken,

Thanks for your suggestion (created two custom groups in the ribbon and I
toggle their visibility). Everything looked to work fine apart from an
issue
with the refresh of the Ribbon. It looks like the Ribbon doesn't refresh
everytime a new inspector (of the same type (ex. Mail.Compose) is created
and
displayed. I put a breakpoint in the callback functions that determine the
visibility of the buttons in the custom Ribbon groups (depending on the
Message Class of the Mail Item) and randomly ignores some calls. I tried
putting calls of the function InvalidateControl("MyRibbonGroupName") to
the
function that creates the Inspector but this didnt solve my problem.

Any suggestions would appreciated.

Nikolas


  #5  
Old December 11th 06, 03:23 PM posted to microsoft.public.outlook.program_forms
Nikolas
external usenet poster
 
Posts: 34
Default multiple ribbons with the same ribbonID

Thanks Ken that worked perfectly.

One more question plz: My custom groups in the Ribbon of the forms depend on
the RibbonID. Since the GetCustomUI(string ribbonID) function gets called
only once, when the Ribbon is first loaded for a given RibbonID, how else can
I find out the RibbonID of an inspector in order to use it in the callback
functions? So far I looked in the Inspector class and in the MailItem class
but didn't find any property there.

Thanks in advance.
Nikolas

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

It's a matter of timing most likely. I've had to deal with two different
timing problems related to ribbons and Inspectors.

The first time an Inspector is instantiated for a ribbon the Ribbon_OnLoad
function hasn't fired yet. So any ribbon references aren't valid. What I do
is set up a dummy Office.IRibbonUI object at module level, knowing it's a
dummy that first time around and will be null (Nothing) until Ribbon_OnLoad
fires.

I have a module level Office.IRibbonUI object in each Inspector wrapper
class that is null for the first Inspector. After that the ribbon object is
valid and the class ribbon object is instantiated when I add the new
Inspector to my wrapper class collection.

In Ribbon_OnLoad I iterate the Inspectors wrapper class collection and
instantiate each ribbon object in each wrapper class.

To take care of the second problem I call the invalidate code in the
Inspector Activate event that fires within my Inspector wrapper class. I can
either call InvalidateControl or if I want everything to be refreshed I can
call Ribbon.Invalidate, which invalidates everything.

See if that helps.

It works in my addin templates for my book. I've used it so far with VB6,
VB.NET, C#, VSTO/VB.NET and VSTO/C# addin templates.

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


"Nikolas" wrote in message
...
Hi Ken,

Thanks for your suggestion (created two custom groups in the ribbon and I
toggle their visibility). Everything looked to work fine apart from an
issue
with the refresh of the Ribbon. It looks like the Ribbon doesn't refresh
everytime a new inspector (of the same type (ex. Mail.Compose) is created
and
displayed. I put a breakpoint in the callback functions that determine the
visibility of the buttons in the custom Ribbon groups (depending on the
Message Class of the Mail Item) and randomly ignores some calls. I tried
putting calls of the function InvalidateControl("MyRibbonGroupName") to
the
function that creates the Inspector but this didnt solve my problem.

Any suggestions would appreciated.

Nikolas



  #6  
Old December 11th 06, 03:47 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default multiple ribbons with the same ribbonID

Nothing is exposed to help you with this, unfortunately. One of the many
things that were ignored during the beta that we pleaded with MS to make
available.

What you have to do is create your own categorization code. You can use the
MessageClass or Class of an item to get a general handle on what type of
item it is. For "Microsoft.Outlook.Mail.Read" you can check for EntryID = ""
and that tells you it's a new item (before it is saved). If on opening it
has no EntryID it's a "Compose" mode item. If it has an EntryID it's a
"Read" mode item. You can further check for or Fwd: in the subject and
for ConversationIndex and ConversationTopic to see if it's a forward or
reply or whatever.

If you check for MessageClass make sure to check for the start of the
MessageClass so you catch custom MessageClass items also.

From there you can also check for the existence of various ribbon tabs in
the existing item to help see what's what. For that of course you have to
make up a list of what's there for different types of open items. Of course
you can't assume that a tab isn't there just because it's not visible. For
example, in Mail.Read there's an Insert tab that's not visible until you use
Message tab, Other Actions, Edit Message when the Insert tab becomes
visible.

It's a bit of a mess actually.

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


"Nikolas" wrote in message
news
Thanks Ken that worked perfectly.

One more question plz: My custom groups in the Ribbon of the forms depend
on
the RibbonID. Since the GetCustomUI(string ribbonID) function gets called
only once, when the Ribbon is first loaded for a given RibbonID, how else
can
I find out the RibbonID of an inspector in order to use it in the callback
functions? So far I looked in the Inspector class and in the MailItem
class
but didn't find any property there.

Thanks in advance.
Nikolas


  #7  
Old December 11th 06, 04:10 PM posted to microsoft.public.outlook.program_forms
Nikolas
external usenet poster
 
Posts: 34
Default multiple ribbons with the same ribbonID

It is indeed but you helped me a lot.

Thanks

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

Nothing is exposed to help you with this, unfortunately. One of the many
things that were ignored during the beta that we pleaded with MS to make
available.

What you have to do is create your own categorization code. You can use the
MessageClass or Class of an item to get a general handle on what type of
item it is. For "Microsoft.Outlook.Mail.Read" you can check for EntryID = ""
and that tells you it's a new item (before it is saved). If on opening it
has no EntryID it's a "Compose" mode item. If it has an EntryID it's a
"Read" mode item. You can further check for or Fwd: in the subject and
for ConversationIndex and ConversationTopic to see if it's a forward or
reply or whatever.

If you check for MessageClass make sure to check for the start of the
MessageClass so you catch custom MessageClass items also.

From there you can also check for the existence of various ribbon tabs in
the existing item to help see what's what. For that of course you have to
make up a list of what's there for different types of open items. Of course
you can't assume that a tab isn't there just because it's not visible. For
example, in Mail.Read there's an Insert tab that's not visible until you use
Message tab, Other Actions, Edit Message when the Insert tab becomes
visible.

It's a bit of a mess actually.

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


"Nikolas" wrote in message
news
Thanks Ken that worked perfectly.

One more question plz: My custom groups in the Ribbon of the forms depend
on
the RibbonID. Since the GetCustomUI(string ribbonID) function gets called
only once, when the Ribbon is first loaded for a given RibbonID, how else
can
I find out the RibbonID of an inspector in order to use it in the callback
functions? So far I looked in the Inspector class and in the MailItem
class
but didn't find any property there.

Thanks in advance.
Nikolas



 




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
Outlook 2007 Ribbons and VB6 Sanjay Singh Add-ins for Outlook 13 October 30th 06 08:26 PM
How to link multiple calendars instead of inputting multiple time tjblue Outlook - Calandaring 2 September 22nd 06 02:38 PM
Downloading multiple email accounts into multiple Outlook Inbox's Surendra M. Gupta Outlook - General Queries 2 July 13th 06 12:07 PM
Multiple accounts to multiple folders - without rules Buckaroo Banzai Outlook - Installation 1 April 6th 06 04:21 AM
Outlook and multiple users on multiple PC's Tom Outlook - General Queries 1 February 11th 06 07:58 AM


All times are GMT +1. The time now is 02:24 PM.


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.