Hi all,

I'm trying to create an Exchange mailbox for an existing user in the
Active Directory. Apparently the CDOEXM.IMailBoxStore interface method
CreateMailBox does this. My problem is I don't know how to get an
object that supports this interface. Until now, I managed to do all
Active Directory work with pure LDAP, avoiding COM,ADSI,CDO,CDOEXM and
Windows things in general. :-) However, this seems to no longer be
sufficient.

I found this VB snippet on MSDN:

-->--

Sub CreateMailboxCDOPerson(strFirstName As String, _
                                   strLastName As String, _
                                   strHomeMDBUrl As String)
'strHomeMDBUrl should look like this
'strHomeMDBUrl = "CN=Mailbox Store (MYSTORE),CN=First Storage Group,
'                 CN=InformationStore,CN=MYSTORE,CN=Servers,
'                 CN=First Administrative Group,CN=Administrative Groups,
'                 CN=IASI,CN=Microsoft
Exchange,CN=Services,CN=Configuration,
'                 DC=mydomain,DC=fourthcoffee,DC=com"

    Dim oPerson         As New CDO.Person
    Dim oMailbox        As CDOEXM.IMailboxStore
    Dim strUserName     As String
    Dim strURL          As String
    Dim strContainerName As String

    strUserName = strFirstName & strLastName

    strContainerName = "Users"
    ' Create URL for the user
    CreateUserURL(strURL, strContainerName, False, strUserName)

    oPerson.FirstName = strFirstName
    oPerson.LastName = strLastName

    oPerson.DataSource.SaveTo strURL

    Set oPerson = New CDO.Person
    ' Bind
    oPerson.DataSource.Open strURL

    ' Create Mailbox
    Set oMailbox = oPerson
    oMailbox.CreateMailbox strHomeMDBUrl

    ' Save
    oPerson.DataSource.Save

    'CleanUp
    Set oPerson = Nothing
    Set oMailbox = Nothing

End Sub

--<--

I don't know VB either (again, I'm not a Windows developer), but I guess
the clue is the line "Set oMailbox = oPerson".

How would I do this in Python? Any help is much appreciated.

Regards,
  Alex
_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to