I would like to search for the bodies of all perspective objects. I know how to do this for the four PIM elements (Notes / Tasks / Assignments / Contacts). But the code is identical for all of them, except that the COM object belongs to a certain type of element (i.e. ContactItem, AppointmentItem, etc.). Is there a parent class for these PIM elements so that I can do something like this in my loop:
using Outlook = Microsoft.Office.Interop.Outlook
List SearchFolderItems( Outlook.Folder folder )
{
List results = new List();
foreach( object folderItem in folder.Items )
{
Outlook.GenericPIMItem item = (Outlook.GenericPIMItem)folderItem;
if( item.Body.ToLower().Contains( "secret sauce" ) )
{
results.Add( item.Name );
}
}
}
The body is a common property of the four PIM elements that I want to receive. Is there such a parent element? Seems to be a bad API design, if not? I suppose I could abstract the folder item so that it looks like the parent ... I also tried to do this with reflection, but I couldn’t get to it.
Any suggestion?