10-04-2008, 08:11 AM
What is the way to call a Non-graphical COM ? I am using hmailserver which has a COM+ application that can be called from VBScript easily. I have posted a sample code. How would do this directly via QM ?
Dim obApp
Set obApp = CreateObject("hMailServer.Application")
' Authenticate. Without doing this, we won't have permission
' to change any server settings or add any objects to the
' installation.
Call obApp.Authenticate("Administrator", "<administrator-password>")
' Locate the domain we want to add the account to
Dim obDomain
Set obDomain = obApp.Domains.ItemByName("example.com")
Dim obAccount
Set obAccount = obDomain.Accounts.ItemByAddress("[email protected]")
MsgBox ListFolders(obAccount.IMAPFolders, 0)
Function ListFolders(obFolders, iRecursion)
' Loop over all folders
iRecursion = iRecursion +1
Dim sMessage
dim i
for i = 0 to obFolders.Count -1
Dim obFolder
Set obFolder = obFolders.Item(i)
sMessage = sMessage & String(iRecursion*3, " ") & obFolder.Name & vbNewLine
sMessage = sMessage & ListFolders(obFolder.SubFolders, iRecursion)
Next
iRecursion = iRecursion -1
ListFolders = sMessage
End Function
IBM Mainframe Expert who Plays with QM a LOT !