MailRead Inspector Windows

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

MailRead Inspector Windows
I need to set a Textbox in the commandbar to the Message ID 
Neil Hoskins




Posts: 27
Joined: 2010-06-14
I have added a Ribbon Group to the Commandbars on the MailRead Inspector window. I have a text box which I need to set to the SMTP Message ID (we log emails to a database by the Message ID as it's the only unique thing we could find by email). We open an email and the Message ID is set, however, we then open another email and the Message ID is set on both windows to the new email. We also need to show whether the email has been filed in the database so need several controls to show data.

How do I set the textbox (redMessageID.text) to be unique per Inspector window. I can't use a form because I use Hubspot Sidekick and it seems to wreak havoc with any other form that opens.

Help please!

ps: I'm using VB.Net 2017 and Add-In-Express 9.1.462 with Outlook 2016 (I have users using Outlook 2007, 2010 and 2013 though).

Neil Hoskins
DDE - Dinosaur Developer Extraordinaire.
Posted 07 Aug, 2018 04:42:48 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Neil,

Check sections Updating ribbon controls at run time and Determining a ribbon control's context at https://www.add-in-express.com/docs/net-ribbon-components.php.


Andrei Smolin
Add-in Express Team Leader
Posted 07 Aug, 2018 04:46:42 Top
Neil Hoskins




Posts: 27
Joined: 2010-06-14
Thanks Andrei, that's really helpful and exactly what I was looking for.

One more quick question if I may; how do I get the email that is being opened in that event please? I also need to change the ScreenTip property.

Neil Hoskins
DDE - Dinosaur Developer Extraordinaire.
Posted 07 Aug, 2018 04:54:00 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
#1. See section Determining a ribbon control's context on that page. I assume, the context will be an Inspector object in your case; you get the item opened in that inspector window via Inspector.CurrentItem.

#2. Intercept the PropertyChanging event of that Ribbon controls and write this code: if (e.PropertyType == ADXRibbonControlPropertyType.ScreenTip) {...}


Andrei Smolin
Add-in Express Team Leader
Posted 07 Aug, 2018 05:31:33 Top
Neil Hoskins




Posts: 27
Joined: 2010-06-14
Thank you Andrei - that'll sort it.

Neil Hoskins
DDE - Dinosaur Developer Extraordinaire.
Posted 07 Aug, 2018 05:33:03 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Ah, use the template below (create missing functions):

private void adxRibbonTab1_PropertyChanging(object sender, ADXRibbonPropertyChangingEventArgs e)
{
    object context = e.Context;
    if (DoesSpecifiedContextMeetsRequirments(context))
    {
        if (e.PropertyType == ADXRibbonControlPropertyType.ScreenTip)
        {
            e.Value = GetNewScreenTipForTheSpecifiedContext(context);
        }
    }
}



Andrei Smolin
Add-in Express Team Leader
Posted 07 Aug, 2018 05:36:27 Top
Neil Hoskins




Posts: 27
Joined: 2010-06-14
Andrei,

Sorry to bother you again but I'm still struggling. When a new inspector window opens, I can detect a "PropertyChanging" and set the value. However, one field determines other controls in the Ribbon.

For example, we use the Message ID of the email to store it in a database and link it to transactions. When the user opens an email we want to show the Message ID and whether it's logged in the database, then what it's linked to. So what I'd like to do is change the Message ID on a Textbox we display, but when we display that Message ID we look up in the database and set other Textboxes automatically.

How?

Neil Hoskins
DDE - Dinosaur Developer Extraordinaire.
Posted 30 Aug, 2018 11:05:53 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Neil,

Neil Hoskins writes:
So what I'd like to do is change the Message ID on a Textbox we display, but when we display that Message ID we look up in the database and set other Textboxes automatically.

How?


Alas, I don't understand your description. How to do what? I try to build a model of what you do but the model is inconsistent. Do you set other ribbon textboxes when you are in the PropertyChanging event of the textbox displaying the message id? I don't think this is correct: you can retrieve data and cache them so that when the other textboxes raise their PropertyChanging events you could provide them with the cached data.


Andrei Smolin
Add-in Express Team Leader
Posted 31 Aug, 2018 02:11:42 Top
Neil Hoskins




Posts: 27
Joined: 2010-06-14
Andrei,

I am trying to set the value of other textboxes when I set the first, basically. I can cache the values and set them in the PropertyChanging but where and how would you suggest initiating the cache? I can build a class with all the values but I need to be certain that if the user opens 10 emails at the same time, the right class points to the right window. I can do anything in the class then.

Thanks.

Neil Hoskins
DDE - Dinosaur Developer Extraordinaire.
Posted 31 Aug, 2018 06:33:18 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Neil,

Every Outlook inspector window displays an Outlook item. You can identify the inspector by getting object item = Inspector.CurrentItem, casting item to Outlook.MailItem, and getting MailItem.EntryId. EntryId is an empty string in case of a new unsaved email but this isn't your case, I guess.


Andrei Smolin
Add-in Express Team Leader
Posted 31 Aug, 2018 06:49:06 Top