Inspector commandbars, popup menus, attachments

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

Inspector commandbars, popup menus, attachments
 
Rick Koch




Posts: 172
Joined: 2006-09-05
(Using addin express VSTO product, VS2005, OL2003)
Looking for a way to control the processing of individual attachments from received emails. In some cases the attachment would be sent to a resume parser, and in other cases it would be submitted to a storage system.

The OOM does not expose individual selected attachments. From what I understand, all that's exposed is the attachments collection, so I'm pretty much forced to either process everything or build some UI to allow the user to choose which files he wants processed.

What I'm wondering, then, is whether I can show the user an "Attachments" pop-up CommandBar menu which dynamically lists all the attachments on the current item. We process whichever one is selected.

Ideally, this would be two-tiered; the first tier would be a choice between Resume an Attachment, and both flyouts would list all the files. Which process we apply would depend on which flyout the user selected the attachment from. What's not clear is whether these menus lend themselves to dynamic rendering, and whether the model exposed through VSTO permits us to use hierarchical flyouts.

Can this be done?
Posted 15 Nov, 2006 16:48:39 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Rick.

Yes, it is possible to implement your idea using the 'Toolbar Controls for Microsoft Office' product. http://www.add-in-express.com/office-toolbar-controls/
You just need to handle the DropDown event of a combo box control that will contain the list of all attachments. Please look at the code below:


private void comboBox1_DropDown(object sender, EventArgs e)
{
object itemObj = null;
Outlook._MailItem mail = null;
Outlook._Inspector insp = null;

try
{
insp = OutlookApp.ActiveInspector();
itemObj = insp.CurrentItem;
if (itemObj is Outlook._MailItem)
{
Outlook.Attachment attachment = null;
Outlook.Attachments attachments = null;

try
{
ComboBox activeComboBox =
adxCommandBarAdvancedControl1.ActiveInstance as ComboBox;

activeComboBox.Items.Clear();

mail = (itemObj as Outlook._MailItem);
attachments = mail.Attachments;
for (int i = 1; i <= attachments.Count; i++)
{
attachment = null;
try
{
attachment = attachments[i];
activeComboBox.Items.Add(attachment.DisplayName);
}
finally
{
if (attachment != null)
Marshal.ReleaseComObject(attachment);
}
}
}
finally
{
if (attachments != null)
Marshal.ReleaseComObject(attachments);
}
}
}
catch(Exception err)
{
this.ShowErrorDialog(this, err);
}
finally
{
if (itemObj != null)
Marshal.ReleaseComObject(itemObj);
if (insp != null)
Marshal.ReleaseComObject(insp);
}
}

P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.


Posted 16 Nov, 2006 09:19:50 Top
Rick Koch




Posts: 172
Joined: 2006-09-05
Actually, it looks like that product doesn't work with the VSTO product. We just purchased it, but I can't install it.

Is there no other way to dynamically manage the pop-up buttons?

I'm looking at the module file, and it really doesn't look like it would be terribly hard to write this. Any chance you guys would "support" it?

I'm envisioning a disabled ADXCommandBarPopup. Logic tied to the InspectorActivate() event would take an inventory of the current item's attachment's collection, and puts a single CommandBarButton into the controls collection for each attachment it finds. It's easy enough to see how the generated code creates such buttons, but it's not clear whether these objects can be defined outside the InitializeComponent method. After the buttons are added to the controls collection, the popup would be enabled.
Posted 16 Nov, 2006 13:17:11 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Rick,

Yes, Toolbar Controls .NET for Microdoft Office doesn't work with Add-in Express NET for VSTO. We include the VSTO edition of Toolbar Controls into ADX.VSTO, Premium Suite.

Should I refund this order?
Posted 17 Nov, 2006 07:43:13 Top
Rick Koch




Posts: 172
Joined: 2006-09-05
So, there is a ToolBars for VSTO, but I can't get it separately? My products were purchased by a "Donald Horne." What is the gap, from where we're currently at, to having the VSTO toolbar functionality?

We're much more interested in the functionality than the refund. Not to steal any thunder from the premium package, is it not possible to get this level of control by manipulating objects in the generated module file? After tinkering with it for a couple of hours yesterday, I've nearly got it working already. I just need to understand how to apply certain commandbar changes.

Is there no way to manage commandbars and buttons after the module initializes?

Posted 17 Nov, 2006 10:25:23 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
I've just answered you by e-mail.
Posted 17 Nov, 2006 11:06:37 Top
Rick Koch




Posts: 172
Joined: 2006-09-05
Not received -- did you send it to Donald's address; he's out today.

Pls send to xxxxxxxx & cc to xxxxxxx

Thanks

========
Please use links at the left of the message to send a private e-mail

Andrei Smoin
Add-in Express
========
Posted 17 Nov, 2006 11:26:40 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Ok, done
Posted 17 Nov, 2006 11:39:26 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Rick.

It is possible to manage ADX command bars and controls after the module initializes. You just need to use the Add and Remove methods of the command bar Controls collection to add/remove controls at runtime.
However there are no events in Outlook that fire when the user changes the Attachments collection in the active inspector. In case of using the DropDown event you can scan the collection whenever the drop-down portion of the combo box is shown.
Posted 17 Nov, 2006 12:17:16 Top