This is a discussion on Adding keywords to the appointment - Microsoft Exchange ; Hi! I'm trying to add a keywod to the appointment object in such way: try { wchar_t* category = L"Category X"; VARIANT vVal; VariantInit(&vVal); vVal.vt = VT_ARRAY | VT_VARIANT; SAFEARRAY * psa = NULL; psa = SafeArrayCreateVector(VT_VARIANT, 0, 1); if(psa!= ...
Hi!
I'm trying to add a keywod to the appointment object in such way:
try
{
wchar_t* category = L"Category X";
VARIANT vVal;
VariantInit(&vVal);
vVal.vt = VT_ARRAY | VT_VARIANT;
SAFEARRAY * psa = NULL;
psa = SafeArrayCreateVector(VT_VARIANT, 0, 1);
if(psa!= NULL)
{
VARIANT* pVal;
hr = SafeArrayAccessData(psa, (void**)&pVal);
VariantInit(&(pVal[0]));
pVal[0].vt = VT_BSTR;
pVal[0].bstrVal = SysAllocString(category);
hr = SafeArrayUnaccessData(psa);
vVal.parray = psa;
hr = pAppointment->put_Keywords(vVal);
hr = SafeArrayDestroy(psa);
psa = NULL;
}
HRESULT hr = VariantClear(&vVal);
}
catch (...)
{
-----
}
It works fine, but only 3-4 times, than my program just goes down. The
funny thing that it goes down not in this code, but in different
places after this code.
Without this code evething works OK!
Could someone give me an advice, please?
Thank you in advance