Selected object

G

Gloup

Hello

I try to to make an Outlook Addin with VS2003. My addin create a button in
Outlook 2003 and the onclik event is fired. Now, how can I get the selected
item in Outlook and determine his type (mail, contact,....). I want to save
a mail as file when I click on my button. I've tried with
appObject.ActiveInspector().CurrentItem
but there is no inspectors (Inspectors.Count is 0)

appObject is defined in "OnConnection" with
appObject = (Microsoft.Office.Interop.Outlook.Application)application;

If somebody have some short examples or urls....

Thanks in advance

JL
PS: Sorry for my bad English.... ;o)
 
S

Sue Mosher [MVP-Outlook]

ActiveInspector is the currently open item. ActiveExplorer is the active folder. The items (note plural) selected in the folder are the ActiveExplorer.Selection collection, which acts like an Outlook Items collection. Determine the type of each item by examining the value of its Class property.
 
G

Gloup

Thank you Sue for your (express) help

JL

Sue Mosher said:
ActiveInspector is the currently open item. ActiveExplorer is the active
folder. The items (note plural) selected in the folder are the
ActiveExplorer.Selection collection, which acts like an Outlook Items
collection. Determine the type of each item by examining the value of its
Class property.
 
G

Gloup

Hello,

How can I do to determine the type of each item with C#? I've no Class
property
Microsoft.Office.Interop.Outlook.Explorer explo =
applicationObject.ActiveExplorer();
Microsoft.Office.Interop.Outlook.Selection sel = explo.Selection;

sel[1].Class.... not exists

I make a test on DefaultItemType like
if(explo.CurrentFolder.DefaultItemType==OlItemType.olMailItem)
But it's not a good idea

Thank's

JLE

Sue Mosher said:
ActiveInspector is the currently open item. ActiveExplorer is the active
folder. The items (note plural) selected in the folder are the
ActiveExplorer.Selection collection, which acts like an Outlook Items
collection. Determine the type of each item by examining the value of its
Class property.
 
G

Gloup

Oops....

if(sel[1] is MailItem)

work fine.

JLE


Gloup said:
Hello,

How can I do to determine the type of each item with C#? I've no Class
property
Microsoft.Office.Interop.Outlook.Explorer explo =
applicationObject.ActiveExplorer();
Microsoft.Office.Interop.Outlook.Selection sel = explo.Selection;

sel[1].Class.... not exists

I make a test on DefaultItemType like
if(explo.CurrentFolder.DefaultItemType==OlItemType.olMailItem)
But it's not a good idea

Thank's

JLE

"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le message
de news: (e-mail address removed)...
ActiveInspector is the currently open item. ActiveExplorer is the active
folder. The items (note plural) selected in the folder are the
ActiveExplorer.Selection collection, which acts like an Outlook Items
collection. Determine the type of each item by examining the value of its
Class property. button
to
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top