Ho to determine the type of item?

  • Thread starter Thread starter Alan
  • Start date Start date
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.
 
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.
 
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.
 
Back
Top