saving mailitem with flagstatus in explorer

saving mailitem with flagstatus in explorer

Post by peter pa » Wed, 15 Sep 2004 18:44:14


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;
}
 
 
 

1. Can I change ExCels default save path for saving add-ins ?

2. How can I create a MailItem that displays like a received MailItem ?

I'm creating an application that uses SQL Server to store important Emails
and I want users to be able to see their emails in a normal Outlook mail
form.

It's working well assigning the HTMLBody etc. from the db except that the
form looks like a new email, not an existing one from a folder - i.e.
Hyperlinks don't work and the To, CC and Subject entries are still
amendable. Is there some way to make the email look as though it has
already been sent / received?

Up to now I've used:

MyMailItem = olApp.CreateItem(olMailItem)
MyMailItem.HTMLBody = <value from db>
etc
MyMailItem.Display

Will I have to create my own type of form?

Many thanks in advance.

Clive Elsworth
UK

3. How do you reference the mailitem in an Explorer preview pane?

4. saving Oulook.MailItem objects

5. Get currently selected mailitem - save to local disk by extended M

6. Saving mailitem as msg-file.

7. Try to save MailItem to disk - EWS - Exchange 2007

8. unexpected behaviour: mailitem.save and attachment

9. Error when saving MailItem or deleting Attachment

10. Prevent automatic save of mailitem

11. saving Oulook.MailItem objects

12. saving a mailitem (custom form) into database with attachments

13. Discarding the changes of mailItem object after saving it to t

14. How to obtain the body of a MailItem that has not been saved.

15. saving Oulook.MailItem objects