Any mapi module functions that use the TCHAR
typemap create some interesting challenges.
In Py2, passing a unicode string require it to first be encoded as utf-16le
as well as setting the MAPI_UNICODE
flag. In Py3, you can only pass unicode strings (and also must still set MAPI_UNICODE
).
While in Py2 this is a reasonable workaround, for Py3, some mapi functions simply will not work with unicode strings and will always fail with MAPI_E_BAD_CHARWIDTH
.
Note, this patch has a dependency on [#156] for its PyWinObject_FromMAPIStr()
function.
It also introduces a new helper function PyWinObject_AsMAPIStr()
which should keep things backward compatible with the existing workaround for Py2 mentioned above.
The bulk of this patch is adding implementations for anything that uses a TCHAR
typemap. Anything that is currently documented as a deprecated MAPI method was not changed. This includes everything in the exchange sdk module, as well as a few methods in the mapi module which were annotated with a Deprecated MAPI function comment.
Old Patches - new patches via https://github.com/mhammond/pywin32/pulls: #156
This looks like an improvement, thanks!
4390:cc08f2559b15