Syntax: %comget(comvariable,propertyname,arguments)

Returns the specified property of a COM object. Use %comcreate to create the comvariable reference. If the property requires optional arguments, list them after the property name. If the Property returns another COM object, you must store it using #VAR, or use it as the first argument of another %comget or %comset function (nested objects). Note that COM Properties are CASE SENSITIVE


#VAR Outlook %comcreate("Outlook.Application")
#VAR NameSpace %comget(Outlook, "GetNamespace", "MAPI")
#VAR Folders %comget(NameSpace, "Folders", "InBox")
#VAR InBox %comget(Folders, "Folders", "InBox")
#VAR N %comget(%comget(InBox,"Items"),"Count")

displays the number of email messages in your InBox. Notice that the intermediate property objects are assigned to other TeSSH variables. However, on the last line we show an example of a nested object call in order to retrieve the "Count" property of the "Items" property.

NOTE: To release the memory associated with a COM object references, simply assign a new value to the variable. Such as:

#VAR Outlook ""

You can also use the more conventional syntax:

#VAR Outlook %comcreate("Outlook.Application")
#VAR NameSpace @Outlook.GetNamespace("MAPI")
#VAR Folders @NameSpace.Folders("InBox")
#VAR InBox @Folders.Folders("InBox")
#SHOW @Inbox.Items.Count

Add comment

Login or register to post comments