I am using Ruby 1.8. Using the WIN32OLE module -
1) How do I determine the class name of an OLE object instance? 2) How can I tell whether an object instance supports a particular method?
In an Outlook automation script, I am trying to delete the items in the 'Deleted Items' folder which are older than 21 days. For mail items, I want to use the ReceivedTime property, but in order to do that, I need to check whether the item is actually a MailItem instance.
For the second, the best I have been able to come up with is (really slow):
def MethodExists(obj, methodName)
obj.ole_methods.each{|method|
if (method.name == methodName)
return true
end
}
return false
end