[python-win32] How to create new MAPI Profile in Python vs C++??
Cheeng, Shu-Chin SC SITI-ITIBDO2
Shu-Chin.Cheeng at Shell.com
Fri Jul 23 23:12:24 CEST 2004
Hi All,
Anyone know how to create new MAPI Profile in Python base on Microsoft C++ code example(http://support.microsoft.com/default.aspx?scid=kb;EN-US;306962)??
this is my source:
===========================================================
from win32com.mapi import mapitags,emsabtags
from win32com.mapi import mapi
from win32com.mapi import mapiutil
import pprint,pythoncom
prf='cgf'
mapi.MAPIInitialize(None)
ma=mapi.MAPIAdminProfiles(0)
ma.DeleteProfile(prf,0)
mt=ma.GetProfileTable(0)
#print '='*50
#pprint.pprint(mt.QueryRows(mt.GetRowCount(0),0))
pf=ma.CreateProfile(prf,None,0,0)
pa=ma.AdminServices(prf,None,0,0)
pa.CreateMsgService('MSEMS',None,0,0)
pst=pa.GetMsgServiceTable(0)
tbp=pst.QueryRows(mt.GetRowCount(0),0)
print '='*50
pprint.pprint(tbp)
print '='*50
tbr=mapi.HrQueryAllRows(pst,None,None,None,0)
pprint.pprint(tbr[0][0][1])
print '='*50
pa.ConfigureMsgService(tbr[0][0][1],0,0,((1711800351,"MyServer"),(1711734815,"csc"))) # it fail in this line
print '='*50
#ma.DeleteProfile(prf,0)
mapi.MAPIUninitialize()
===========================================================
result:
===========================================================
C:\csc\PY\PyKIV>mpii.py
C:\Python23\lib\site-packages\win32comext\mapi\mapitags.py:59: FutureWarning: x<
<y losing bits or changing sign will return a long in Python 2.4 and up
return (ulPropID<<16)|(ulPropType)
==================================================
(((1024196866, '\xda\xc2\xbf\xe3@\xd0\x83E\xac\x9ds\x8b\xd3G_\xa4'),
(805371934, 'Microsoft Exchange Server'),
(1024000030, 'MSEMS'),
(805896195, 3),
(1024065566, 'emsui.dll'),
(1024131102, 'EMSCfg'),
(1024397342, ('emsui.dll', 'emsabp.dll', 'emsmdb.dll')),
(267780354, '\xda\xc2\xbf\xe3@\xd0\x83E\xac\x9ds\x8b\xd3G_\xa4')),)
==================================================
'\xda\xc2\xbf\xe3@\xd0\x83E\xac\x9ds\x8b\xd3G_\xa4'
==================================================
Traceback (most recent call last):
File "C:\csc\PY\PyKIV\mpii.py", line 23, in ?
pa.ConfigureMsgService(tbr[0][0][1],0,0,((1711800351,"cbj-s-342"),(171173481
5,"klcsc2")))
pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)
===========================================================
Found:
in Python ConfigureMsgService(iid, ulUIParam, ulFlags, [SPropValue, ...])
in C++ HRESULT ConfigureMsgService( LPMAPIUID lpUID, ULONG ulUIParam, ULONG ulFlags, ULONG cValues, LPSPropValue lpProps );
Where:
LPMAPIUID lpUID <> iid
in python need IID (GUID) but in C++ need 16 bytes of MAPIUID...
Anyone know the trick & tips on this???
Regards,
Cheeng Shu Chin
SA-Messaging
Shell Information Technology International
2340 Century Square, Jalan Usahawan, 63000 Cyberjaya, Selangor D.E., Malaysia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20040724/3f862c7c/attachment.html
More information about the Python-win32
mailing list