views:

18

answers:

0

I have the following being displayed when I show a message box in an Outlook AddOn

this.Application.ActiveExplorer().Selection.Count.ToString()

When the application first starts, it doesn't show when I click the addon button. After I select a folder, or an email object, it shows "0". When I select two emails, it shows "1".

Why is one object always missing?

this is the whole code for the button:

        private void buttonOne_Click(Office.CommandBarButton ctrl, ref bool cancel)
    {
        MessageBox.Show(this.Application.ActiveExplorer().Selection.Count.ToString());

    }