Help with Outlook mail object detection

Help with Outlook mail object detection

Postby Gale FORd » Mon Sep 26, 2011 6:41 pm

I need to get the class of an item in Outlook so I know if it is a valid mail item.
I can't get the class property to work.
Can someone please help me determine what kind if items they are?

[code]
function mytest()
local oOutlook, oExp, oItem, nClass, tReceived
oOutlook := TOleAuto():New( "Outlook.Application" )
oExp := oOutlook:ActiveExplorer
oItem := myOlExp:Selection:Item(1)
// This is supposed to return the class of the item object.
// if oItem:Class = 42 then it should be an email object but it returns another object.
nClass := oItem:Class
tracelog( nClass )
// If the current item is a regular email then the following line works.
// If the current item is an undeliverable message or something other than mail thenthe following line fails
tReceived := oItem:ReceivedTime
return nil
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Help with Outlook mail object detection

Postby Gale FORd » Thu Oct 06, 2011 6:55 pm

Ok it looks like Fivewin is stripping :Class from the assignment.

With #INCLUDE "FIVEWIN.CH" the only change in the sample programs below.
nClass := oItem:Class
turns into
nClass := oItem
in the .ppo

Without #INCLUDE "FIVEWIN.CH"
nClass := oItem:Class
stays that way and works correctly.

This code does not work. Check the .ppo and you will see
Code: Select all  Expand view

#INCLUDE "FIVEWIN.CH"
function mytest()
local oOutlook, oExp, oItem, nClass, tReceived
  oOutlook := TOleAuto():New( "Outlook.Application" )
  oExp := oOutlook:ActiveExplorer
  oItem := oExp:Selection:Item(1)
  // oItem:Class is supposed to return the class of the item object.
  // if oItem:Class = 42 then it should be an
  // email object but it returns another object.
  nClass := oItem:Class
  tracelog( nClass )
return nil
 


This code works.
Code: Select all  Expand view

function mytest()
local oOutlook, oExp, oItem, nClass, tReceived
  oOutlook := TOleAuto():New( "Outlook.Application" )
  oExp := oOutlook:ActiveExplorer
  oItem := oExp:Selection:Item(1)
  // oItem:Class is supposed to return the class of the item object.
  // if oItem:Class = 42 then it should be an
  // email object but it returns another object.
  nClass := oItem:Class
  tracelog( nClass )
return nil
 
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 97 guests