Forum: Ruby creating Exchange mailBox via Ruby?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Df8e3c977eac4ecdb8f50eaf876402dc?d=identicon&s=25 tech.samaritan (Guest)
on 2005-12-08 21:13
(Received via mailing list)
Howdy!

I am setting up services that automagically provision a new portal user
with things like filespace, and an Exchange mailbox.  The filespace is
easy, but I have not found any way to do the Exchange part.  I have
many vbscript examples, but that does not help me any if ruby cannot do
what vbs can.  So the question is:

Can Ruby interact with Exchange Information Stores, by creating
mailboxes, changing mailbox properties and the like?

The vbs examples look like they use LDAP to connect and interact, but
the methods that are used seem to be specific to vbs.  Any one with any
experience with this?

PS.  I know that I can use vbs, but our setup would require the scripts
to be run on a DC, and I would like to avoid that type of dependance.
Df8e3c977eac4ecdb8f50eaf876402dc?d=identicon&s=25 tech.samaritan (Guest)
on 2005-12-08 21:13
(Received via mailing list)
I am looking into ADSI now...  wondering if I can do almost the exact
same stuff in ruby as what I found in vbs...
A777f1a2049d78a12ead38efb8f75f97?d=identicon&s=25 tanner.burson (Guest)
on 2005-12-08 21:13
(Received via mailing list)
On 12/8/05, tech.samaritan@gmail.com <tech.samaritan@gmail.com> wrote:
> mailboxes, changing mailbox properties and the like?
>
> The vbs examples look like they use LDAP to connect and interact, but
> the methods that are used seem to be specific to vbs.  Any one with any
> experience with this?
>
> PS.  I know that I can use vbs, but our setup would require the scripts
> to be run on a DC, and I would like to avoid that type of dependance.


Sure it can.  Check out the Win32OLE library.  It allows you to make all
of
the same calls you would in VBScript, in Ruby.  I don't have a link off
hand, but if you used the ruby installer for win32 you've already got
it.
Df8e3c977eac4ecdb8f50eaf876402dc?d=identicon&s=25 tech.samaritan (Guest)
on 2005-12-09 00:13
(Received via mailing list)
I have found that I can do all the normal stuff, but interaction with
exchange is via CDOEXM.DLL, and I still have to see if WIn32OLE will do
that part as well.  I can return all the user properties, and even the
HomeMDB which is the full path to the user's mailbox, but I have not
had any success with CreateMailbox.  I am thinking that I may have to
do it on the server for it to have access to the right DLL.
A777f1a2049d78a12ead38efb8f75f97?d=identicon&s=25 tanner.burson (Guest)
on 2005-12-09 18:56
(Received via mailing list)
On 12/8/05, tech.samaritan@gmail.com <tech.samaritan@gmail.com> wrote:
>
> I have found that I can do all the normal stuff, but interaction with
> exchange is via CDOEXM.DLL, and I still have to see if WIn32OLE will do
> that part as well.  I can return all the user properties, and even the
> HomeMDB which is the full path to the user's mailbox, but I have not
> had any success with CreateMailbox.  I am thinking that I may have to
> do it on the server for it to have access to the right DLL.


Really the only difference between performing this task in Ruby versus
doing
it in VBScript is that you get to use Ruby :)  Otherwise the same
restrictions still apply.   The COM Objects still have to reside locally
unless you're doing some DCOM mojo.  To my knowledge though CDO has to
be
installed locally, but that doesn't mean it has to be run from the
Exchange
server.  I've seen automated Exchange creation run via a VBScript on a
member server in the domain, as opposed to directly on the Exchange box.
You just need to make sure you get CDO and all of that installed on the
box
you want to do the creation from.
Df8e3c977eac4ecdb8f50eaf876402dc?d=identicon&s=25 unknown (Guest)
on 2005-12-13 16:29
(Received via mailing list)
I have the Exchange Management Tools installed, and I can do a little
more than before.  I can query and set attributes, but I cannot
actually create a mailbox or set store defaults on existing mail boxws.
 It tells me it is an invalid method in both cases.

Here is the bit of code:

	usr =WIN32OLE.connect("LDAP://CN=" + @login + cont)
		usr.CreateMailbox("LDAP://" + mBox )
		usr.EnableStoreDefaults = TRUE
		usr.AccountDisabled = FALSE
		usr.SetInfo
		usr.put "protocolsettings" , "POP3§0§1§4§ISO-8859-1§0§§§"
		usr.setinfo

I would really love to be able to do this in Ruby, since cscript takes
so land to start it adds 10+ seconds to the operation.
This topic is locked and can not be replied to.