Use same Ribbon in Multiple Inspectors

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

Use same Ribbon in Multiple Inspectors
 
Gerhard Grossberger




Posts: 14
Joined: 2011-08-10
Works fine. I attached to adxOutlookEvents_InspectorActivate-Event and dis-/enable some features in Ribbon depending on current Item.

Thanks for your support, Gerhard
Posted 05 Sep, 2011 06:38:56 Top
Gerhard Grossberger




Posts: 14
Joined: 2011-08-10
Hi again,
this seemed to work correctly, but now I stumbeld upon a bug:
When i click around a lot and open and close different inspectors (which is what users will do) sometimes the whole ribbon disappears. I guess that something is wrong in the XML, or it getīs currupted, but I have no way to verify.

Is there a way to view the content of RibbonXML in adxOutlookEvents_InspectorActivate Event?

Regards, Gerhard
Posted 06 Sep, 2011 04:25:28 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Gerhard,

Nope. Please use the OnRibbonBeforeCreate, OnRibbonBeforeLoad and OnRibbonLoaded event handlers for such task. Did you try to debug? Do you get any exceptions or ribbon UI error messages?
.NET, Extended MAPI, Windows Phone & RT
Posted 06 Sep, 2011 04:51:10 Top
Gerhard Grossberger




Posts: 14
Joined: 2011-08-10
Hi,
i canīt use these events, because I have to react to a custom property set in the Item itself.

void adxOutlookEvents_InspectorActivate(object sender, object inspector, string folderName)
{
try
{
if (inspector != null && inspector!=currentInspector)
{
OL.Inspector _inspector = inspector as OL.Inspector;
object currentItem = (_inspector).CurrentItem;
currentInspector = inspector;
// set buttons disabled
rbnBtnShowInRefinder.Enabled = false;
rbnBtnAddToRefinder.Enabled = false;
log.Debug("activated Inspector: " + OutlookTools.getLabel(currentItem) + " / " + folderName);
if (currentItem != null)
{
// get UUID from custom property
string currentUUID = OutlookTools.GetStoredThingUUID(currentItem);
log.Debug("found uuid: " + currentUUID);
if (!String.IsNullOrEmpty(currentUUID))
{
// get UUID from custom property
rbnBtnShowInRefinder.Enabled = true;
log.Debug("enabled Show in Refinder button: " + rbnBtnShowInRefinder.Enabled);
}
}
rbnBtnAddToRefinder.Enabled = !rbnBtnShowInRefinder.Enabled;
Marshal.ReleaseComObject(currentItem);
currentItem = null;
}
}
catch (Exception ex)
{
log.Error("Error in Inspector Activate: " + ex.Message);
}
}

The code throws no error, everything works fine. Errormessage is never shown in logs.

In a Custom TaskPane in the inspector, the currentItem is also accessed. As far as I see, there is a problem with synchronous access to this item.
Posted 06 Sep, 2011 05:48:11 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Gerhard,

Please use the OnPropertyChanging event handler of your ribbon controls for setting the Enabled property. You can read more about this in the Properties and events of Ribbon components section of the online documentation.
.NET, Extended MAPI, Windows Phone & RT
Posted 06 Sep, 2011 06:08:13 Top
Gerhard Grossberger




Posts: 14
Joined: 2011-08-10
Hi, works far better than InspectorActivated.
Thanks, gerhard
Posted 06 Sep, 2011 07:50:03 Top