[python-win32] Extended MAPI : ConfigureMsgService Problem
Whitaker, Simon SITI-SITI
Simon.Whitaker at shell.com
Mon Jan 17 22:52:50 CET 2005
Cheers Mark, now we are cooking with Gas!
The "MakeIID" works a treat, and the reason why the code then failed immediately after is due to a silly error on my part. From the original post...
---
# Administer the profile services
serviceAdmin = profileAdmin.AdminServices(profileName, None, 0, 0)
serviceAdmin.CreateMsgService('MSEMS', None, 0, 0)
serviceAdmin.CreateMsgService('MSPST MS', None, 0, 0)
# Get the service table - looking for service IDs
msgServiceTable = serviceAdmin.GetMsgServiceTable(0)
msgServiceRows = mapi.HrQueryAllRows(msgServiceTable, None, None, None, 0)
# Get the service ID of the first service
serviceUID = msgServiceRows[1][0][1]
---
The last line actually gets the UID of the second service, ie: the MS PST which is why it couldn't be configured as an MSEMS service.
Ooops.
Changed the last line to "serviceUID = msgServiceRows[0][0][1]" and it works fine.
Thanks again - saves me getting VisC installed and trying to write it ;)
Simon
-----Original Message-----
From: Mark Hammond [mailto:mhammond at skippinet.com.au]
Sent: Tuesday, 18 January 2005 8:03 AM
To: Whitaker, Simon SITI-SITI; python-win32 at python.org
Subject: RE: [python-win32] Extended MAPI : ConfigureMsgService Problem
> The code is pretty clearly defined in C on MSDN, but when translated to Python,
> it fails when configuring services within the created profile.
I have got past your immediate stumbling-block, just to hit another.
> One possible issue is with the serviceUID, which when viewed in the IDE is
> [}YÆ8PÍEÅ-4ÂfY] which looks pretty interesting.
It seems very likely that this is a GUID encoded as a binary buffer (being 16 bytes (128 bits) long):
Adding:
serviceUID = pythoncom.MakeIID(serviceUID, 1)
print "now is", serviceUID
Results in:
now is {607D544A-A7BF-412D-8EC7-E376FF96572C}
Traceback (most recent call last):
File "\temp\make_profile.py", line 41, in ?
serviceAdmin.ConfigureMsgService(serviceUID, 0, 0, propsTuple) # <- !!! FAILS HERE !!!
pywintypes.com_error: (-2147221233, 'OLE error 0x8004010f', None, None)
0x8004010f is MAPI_E_NOT_FOUND. This is as far as I got.
Mark.
More information about the Python-win32
mailing list