Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mapi - AllocMVBuffer (mapiutil.cpp) should set an error after PySequence_Check #1250

Closed
nczeczulin opened this issue Sep 26, 2018 · 0 comments

Comments

@nczeczulin
Copy link
Contributor

SystemError('<built-in function HrSetOneProp> returned NULL without setting an error',)
SystemError('<built-in method SetProps of PyIMessage object at 0x03830D8C> returned NULL without setting an error',)
import pythoncom
from win32com import storagecon
from win32com.mapi import mapi
from win32com.mapi import mapitags

mapi.MAPIInitialize((mapi.MAPI_INIT_VERSION, mapi.MAPI_MULTITHREAD_NOTIFICATIONS))
try:
    lockbytes = pythoncom.CreateILockBytesOnHGlobal(None, True)
    mode = storagecon.STGM_CREATE | storagecon.STGM_READWRITE | storagecon.STGM_SHARE_EXCLUSIVE
    storage = pythoncom.StgCreateDocfileOnILockBytes(lockbytes, mode, 0)
    msg = mapi.OpenIMsgOnIStg(0, None, storage, None, 0, mapi.MAPI_UNICODE)
    proptag = mapitags.PROP_TAG(
        mapitags.PT_MV_I4,
        mapitags.PROP_ID(msg.GetIDsFromNames(((mapi.PS_PUBLIC_STRINGS, 'Test123'),), mapi.MAPI_CREATE)[0])
    )
    try:
        mapi.HrSetOneProp(msg, (proptag, None))
    except Exception as e:
        print(repr(e))
    try:
        msg.SetProps(((proptag, None),))
    except Exception as e:
        print(repr(e))
finally:
    msg = None
    storage = None
    lockbytes = None
    mapi.MAPIUninitialize()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant