Create exchange Mailbox from python

匆匆过客 提交于 2019-12-13 19:31:41

问题


I need to create a mailbox on an exchange 2003 server using python. The stunt conditions are that our machines have either office 2007 and office 2010 installed and thus the cdoexm.dll is not installed on the system. Also as it is 2007/10 you cant install the ExchangeCdo as it requires certain versions of outlook. Also mapi is not enabled on the server.

Is this a case where I will have to call an external program to do this? I've spent the last couple of days trawling sites but all the solutions seem to use cdoexm.

Hope someone has some ideas!


回答1:


OK so it wasn't a python problem in the end but did require CDOEXM. First you need to go to control panel->add/remove programs->add/remove windows components. Select Internet Information Services (IIS) and click details, tick Internet Information Services Snap-In and click OK, then next and install (you will need the xp sp3 cd for this).

After this is done you will need the exchange server (in my case 2003) install cd and you want to install management components only. When this is finally done you will have the CDOEXM dll which you can then use in your projects.

Heres an example using Tim Golden's awesome active directory module for Python.

import active_directory

homeMDB = "CN=UBER MAILBOX,CN=InformationStore,CN=UBERMAILSERVER,"\
        "CN=Servers,CN=Administrative Groups,CN=UBERORG,"\
        "CN=Microsoft Exchange,CN=Services,CN=Configuration,"\
        "DC=uber,DC=org,DC=uk"

user=active_directory.find_user("captain.awesomeface")
user.CreateMailbox(homeMDB)


user.Properties["mail"].Value = "captain.awesomeface@uberorg.com";

user.SetInfo()


来源:https://stackoverflow.com/questions/4827758/create-exchange-mailbox-from-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!