Creating Mail Item with Sent flag set to true

  • Thread starter Thread starter Dan Mclennan
  • Start date Start date
D

Dan Mclennan

Hi, I have been tasked with synchronizing emails located
on an external mail store into an Outlook Client. For the
most part this has been achieved however when I create a
mailitem in Outlook, the sent status is set to false and
hence the send button is available when ever the emails
are opened.

So what I want to know how to create the email so that the
sent status (which is read-only) is set to true, so that
the emails I create do not have the send button available
to them.

Most of the examples I have seen so far on the web and
through this newsgroup have been for sending new emails.
Whilst I'm trying to create copies of already existing
received emails.

If any one can help me out I'd very much appreciate it.

Cheers

Dan Mclennan
(e-mail address removed)
 
Create olPostItem instead of olMailItem, then change the message class to
IPM.Note and save it.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Thanks Dmitry, Yes it appears this has solved the issue of
removing the Sent button, but now I don't have the ability
to modify the To or From fields, as the PostItem has these
as read-only, additionally the change in type means that
the Read/Not Read value doesn't affect the message icon
type, thus to the end user there's no way to differentiate
between read and non read emails.

The application which I'm building is very similar to
ActiveSync, except that its synchronizing an offline
Outlook client to a third-party Web based mail store over
a SOAP based com application.

So I want to retain the ability to set and manipulate all
mail fields. So I guess is there any more advise available?

Thanks

Dan
 
That's why you need to change the message class back to IPM.Note, so that
the next time you open it, it will be be the regular MailItem:

set NewMsg =
Application.Session.GetDefaultFolder(olFolderDrafts).Items.Add(olPostItem)
NewMsg.Save
NewMsg.MessageClass = "IPM.Note"
NewMsg.Save
strEntryID = NewMsg.EntryID
set NewMsg = Nothing
set NewMsg = Application.Session.GetItemFromID(strEntryID)
NewMsg.Display

Note that the icon will be wrong, you must delete (or change) the
PR_ICON_INDEX property; see http://www.dimastr.com/redemption/faq.htm#8 for
an example that uses Redemption

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Back
Top