Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Non-graphical COM
#1
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 ?

Code:
Copy      Help
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("test@example.com")      

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 !
#2
Macro
Code:
Copy      Help
IDispatch obApp
obApp._create("hMailServer.Application")
obApp.Authenticate("Administrator", "<administrator-password>")

IDispatch obDomain
obDomain = obApp.Domains.ItemByName("example.com")

or

Macro
Code:
Copy      Help
str vbcode=
;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

VbsExec vbcode
#3
Wooohooo !! IDispatch - Just what I was looking for ......... Any side-effects you know of ?
IBM Mainframe Expert who Plays with QM a LOT !


Forum Jump:


Users browsing this thread: 1 Guest(s)