Com Properties.

Use this forum if you have problems with a hMailServer script, such as hMailServer WebAdmin or code in an event handler.
Post Reply
User avatar
timex163
Normal user
Normal user
Posts: 38
Joined: 2014-06-17 13:20
Location: Montréal

Com Properties.

Post by timex163 » 2014-10-23 03:18

Greetings,

Is there a full documentation on the Com API of hmailserver.

Right now, I found that i can call the version by using the version property but can't find it in the documentation api page. Is there like a better reference then the documentation.

percepts
Senior user
Senior user
Posts: 5282
Joined: 2009-10-20 16:33
Location: Sceptred Isle

Re: Com Properties.

Post by percepts » 2014-10-23 04:06

if you have a script editor with an object browser then you can load the COM library "Hmailserver Type Library" into it and view all the com api object, methods and variables.

Visual Studio Express can do this or the Microsoft Script editor (MSEn.exe) which comes with microsoft office.

Its not documentation but rather a much easier way of finding everything in com api.

User avatar
timex163
Normal user
Normal user
Posts: 38
Joined: 2014-06-17 13:20
Location: Montréal

Re: Com Properties.

Post by timex163 » 2014-10-23 06:21

Thank you for the reply.

I just installed Hmailserver on my local machine since i have VB express installed and i can't get the com browser to open it.

I even tryed to see if com was working with this :

Code: Select all


   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", "testar")
   
   ' 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("account@example.com")
   
   ' Set the password to "secret"   
   obAccount.Password = "secret"   

   obAccount.Save



And
nada.

On VB express it tells me : The selected property cannot be browsed.


Even the version parameter is not working.

Any clue on what i may be missing ?

User avatar
SorenR
Senior user
Senior user
Posts: 3211
Joined: 2006-08-21 15:38
Location: Denmark

Re: Com Properties.

Post by SorenR » 2014-10-23 11:39

timex163 wrote:Thank you for the reply.

I just installed Hmailserver on my local machine since i have VB express installed and i can't get the com browser to open it.

I even tryed to see if com was working with this :

Code: Select all


   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", "testar")
   
   ' 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("account@example.com")
   
   ' Set the password to "secret"   
   obAccount.Password = "secret"   

   obAccount.Save



And
nada.

On VB express it tells me : The selected property cannot be browsed.


Even the version parameter is not working.

Any clue on what i may be missing ?
The code you show is for VBScript... Are you trying to make VB code?

I was mocking around with some VB code (not VBScript) a while back...
Attachments
hMailDiag-0.0.1.rar
(21.65 KiB) Downloaded 73 times
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

percepts
Senior user
Senior user
Posts: 5282
Joined: 2009-10-20 16:33
Location: Sceptred Isle

Re: Com Properties.

Post by percepts » 2014-10-23 13:39

save the file as .vbs and then double click it.

We aren't here to teach you how to code. You must figure it out yourself.

User avatar
timex163
Normal user
Normal user
Posts: 38
Joined: 2014-06-17 13:20
Location: Montréal

Re: Com Properties.

Post by timex163 » 2014-10-25 01:05

Thanks for the post.

The thing is, everything works well on my windows server 2012 installation but in my windows 8.1 machine it does not work.

I can't run the script.

User avatar
SorenR
Senior user
Senior user
Posts: 3211
Joined: 2006-08-21 15:38
Location: Denmark

Re: Com Properties.

Post by SorenR » 2014-10-25 01:20

timex163 wrote:Thanks for the post.

The thing is, everything works well on my windows server 2012 installation but in my windows 8.1 machine it does not work.

I can't run the script.
If your Admin GUI works - then COM is installed correct...

On my laptop - where I have a "play" hmailserver installed - I must select from the GUI which hMail to administer.. The same you have to do with the VBS script...

Set obApp = CreateObject("hMailServer.Application", "server")

or

Set obApp = CreateObject("hMailServer.Application", "laptop")

http://www.w3schools.com/vbscript/func_createobject.asp
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

User avatar
timex163
Normal user
Normal user
Posts: 38
Joined: 2014-06-17 13:20
Location: Montréal

Re: Com Properties.

Post by timex163 » 2014-10-25 01:57

You where right thanks !

That made it work !!

SorenR you the best !

Has for you " percepts ", from now on, please refrain from posting on my topics. Every-time you intervene there's an insult with it.

User avatar
mattg
Moderator
Moderator
Posts: 20228
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Com Properties.

Post by mattg » 2014-10-25 12:18

timex163 wrote:as for you " percepts ", from now on, please refrain from posting on my topics. Every-time you intervene there's an insult with it.
I don't think that was warranted.

I don't think that was very nice either.

Be thankful that anyone responds. After all we are all volunteers.
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

Post Reply