Ho to determine the type of item?

A

Alan

Hi All,

In a given folder, we may have multiple item types (mailitem and
postitem being the most common).

In referencing a given item, it appears that I need to know the item
type to be able to access the specific properties for that item, and
to use the appropriate methods (e.g. item.send for a mailitem vs
item.post for a postitem).

If I have a collection of items from a folder (MapiFolder.Items) and I
refer to them one by one Items(1) or Items (5) for example, how can I
tell the item type?

Thanks in advance,

Alan.
 
M

Michael Bauer

Hi Alan,

in general you can check each objecttype with:
If TypeOf YourObjectVariable Is Outlook.MailItem Then ...

The OOM is more comfortable. For each Item a Class property is
available. E.g.: If YourObjectVariable.Class = olMail then ...

Please take a look in your Object Browser for all available values. You
can find them in the OlObjectClass enumeration.
 
A

Alan

Michael Bauer said:
Hi Alan,

in general you can check each objecttype with:
If TypeOf YourObjectVariable Is Outlook.MailItem Then ...

The OOM is more comfortable. For each Item a Class property is
available. E.g.: If YourObjectVariable.Class = olMail then ...

Please take a look in your Object Browser for all available values.
You can find them in the OlObjectClass enumeration.

Thank you Michael.

Embarrassingly obvious when you point it out.

Much appreciated,

Alan.
 

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