P
peter pan
hello,
i've try to save an mail item in the inbox (explorer).
first i set the flag status to olMarked; then i put a flag
request text. at the end i save the item.
after saving, the flag status is not set (no flag). but if
i open the item (inspector) i can read the flag request.
when i restart outlook the flag request is also away
if i save the mail item in the inspector window it works
fine
- the flag status is set and the flag request
text, too. after i restart outlook the information are
always there
here is my sample code:
// mark the eMail as market
nFlagStatus = 2;
szMember = L"FlagStatus";
dispid = 0;
vReturn.vt = -1;
static BYTE BASED_CODE paramsSetFlagStatus[] =
VTS_I4;
hRes = pMailItem->GetIDsOfNames(IID_NULL,
&szMember, 1, LOCALE_SYSTEM_DEFAULT, &dispid);
if(SUCCEEDED(hRes))
{
dispDriver.AttachDispatch(pMailItem, TRUE);
try
{
dispDriver.InvokeHelper(dispid,
DISPATCH_PROPERTYPUT, VT_VARIANT, &vReturn,
paramsSetFlagStatus,
2); //static_cast<Outlook::OlFlagStatus>(olFlagMarked)
}
catch(...)
{
dispDriver.DetachDispatch();
return;
}
dispDriver.DetachDispatch();
}
else
{
return;
}
// set the mark text
szMember = L"FlagRequest";
dispid = 0;
vReturn.vt = -1;
static BYTE BASED_CODE paramsSetFlagRequest[] =
VTS_BSTR;
hRes = pMailItem->GetIDsOfNames(IID_NULL,
&szMember, 1, LOCALE_SYSTEM_DEFAULT, &dispid);
if (SUCCEEDED(hRes))
{
XTRACE(+0, "have the ID for the property
(put_FlagRequest)");
dispDriver.AttachDispatch(pMailItem, TRUE);
try
{
dispDriver.InvokeHelper(dispid,
DISPATCH_PROPERTYPUT, VT_VARIANT, &vReturn,
paramsSetFlagRequest, sNewFlagRequest);
}
catch(...)
{
dispDriver.DetachDispatch();
return;
}
dispDriver.DetachDispatch();
}
else
{
return;
}
// save the eMail with the new market
szMember = L"Save";
dispid = 0;
vReturn.vt = -1;
hRes = pMailItem->GetIDsOfNames(IID_NULL,
&szMember, 1, LOCALE_SYSTEM_DEFAULT, &dispid);
if (SUCCEEDED(hRes))
{
dispDriver.AttachDispatch(pMailItem, TRUE);
try
{
dispDriver.InvokeHelper(dispid,
DISPATCH_METHOD, VT_VARIANT, &vReturn, NULL, NULL);
}
catch(...)
{
dispDriver.DetachDispatch();
return;
}
dispDriver.DetachDispatch();
}
else
{
return;
}
i've try to save an mail item in the inbox (explorer).
first i set the flag status to olMarked; then i put a flag
request text. at the end i save the item.
after saving, the flag status is not set (no flag). but if
i open the item (inspector) i can read the flag request.
when i restart outlook the flag request is also away
if i save the mail item in the inspector window it works
fine
text, too. after i restart outlook the information are
always there
here is my sample code:
// mark the eMail as market
nFlagStatus = 2;
szMember = L"FlagStatus";
dispid = 0;
vReturn.vt = -1;
static BYTE BASED_CODE paramsSetFlagStatus[] =
VTS_I4;
hRes = pMailItem->GetIDsOfNames(IID_NULL,
&szMember, 1, LOCALE_SYSTEM_DEFAULT, &dispid);
if(SUCCEEDED(hRes))
{
dispDriver.AttachDispatch(pMailItem, TRUE);
try
{
dispDriver.InvokeHelper(dispid,
DISPATCH_PROPERTYPUT, VT_VARIANT, &vReturn,
paramsSetFlagStatus,
2); //static_cast<Outlook::OlFlagStatus>(olFlagMarked)
}
catch(...)
{
dispDriver.DetachDispatch();
return;
}
dispDriver.DetachDispatch();
}
else
{
return;
}
// set the mark text
szMember = L"FlagRequest";
dispid = 0;
vReturn.vt = -1;
static BYTE BASED_CODE paramsSetFlagRequest[] =
VTS_BSTR;
hRes = pMailItem->GetIDsOfNames(IID_NULL,
&szMember, 1, LOCALE_SYSTEM_DEFAULT, &dispid);
if (SUCCEEDED(hRes))
{
XTRACE(+0, "have the ID for the property
(put_FlagRequest)");
dispDriver.AttachDispatch(pMailItem, TRUE);
try
{
dispDriver.InvokeHelper(dispid,
DISPATCH_PROPERTYPUT, VT_VARIANT, &vReturn,
paramsSetFlagRequest, sNewFlagRequest);
}
catch(...)
{
dispDriver.DetachDispatch();
return;
}
dispDriver.DetachDispatch();
}
else
{
return;
}
// save the eMail with the new market
szMember = L"Save";
dispid = 0;
vReturn.vt = -1;
hRes = pMailItem->GetIDsOfNames(IID_NULL,
&szMember, 1, LOCALE_SYSTEM_DEFAULT, &dispid);
if (SUCCEEDED(hRes))
{
dispDriver.AttachDispatch(pMailItem, TRUE);
try
{
dispDriver.InvokeHelper(dispid,
DISPATCH_METHOD, VT_VARIANT, &vReturn, NULL, NULL);
}
catch(...)
{
dispDriver.DetachDispatch();
return;
}
dispDriver.DetachDispatch();
}
else
{
return;
}