Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / December 2003

Tip: Looking for answers? Try searching our database.

Setting "sent" flag

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tim Attwood - 24 Dec 2003 11:40 GMT
How can I set the sent flag (and sendername etc) for a newly created
MailItem.

This is what I have so far but it doesn't work :-(

MAPIFolder oInbox =
mNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox) ;
MailItem oItem =
(MailItem)mApplicationObject.CreateItemFromTemplate("C:\\Program
Files\\Microsoft Office\\Office\\VoiceRite.oft", oInbox);

oItem.Save();
string ID = oItem.EntryID;

oItem = (MailItem)mNameSpace.GetItemFromID(ID, oInbox.StoreID);
Redemption.SafeMailItem sItem =
(Redemption.SafeMailItem)mApplicationObject.CreateObject("Redemption.SafeMai
lItem");
sItem.Item = oItem;

int prMessageFlags = 0x0E070003;
int prSenderName = 0x0C1A001E;
int prSenderEmailAddress = 0x0C1F001E;

sItem.set_Fields(prSenderEmailAddress, "sender@here.com");
sItem.set_Fields(prMessageFlags, 0);
sItem.set_Fields(prSenderName, "Sender Name");

oItem.Save();
oItem.Move(oInbox);

oItem = null;
sItem = null;
oInbox = null;

Tim Attwood
Ken Slovak - [MVP - Outlook] - 24 Dec 2003 14:25 GMT
Sent is read-only. It's set by the spooler after you submit a message
to it.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginners Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> How can I set the sent flag (and sendername etc) for a newly created
> MailItem.
[quoted text clipped - 12 lines]
> oItem = (MailItem)mNameSpace.GetItemFromID(ID, oInbox.StoreID);
> Redemption.SafeMailItem sItem =

(Redemption.SafeMailItem)mApplicationObject.CreateObject("Redemption.S
afeMai
> lItem");
> sItem.Item = oItem;
[quoted text clipped - 15 lines]
>
> Tim Attwood
Dmitry Streblechenko - 28 Dec 2003 17:41 GMT
Sent flag is read-write before the first save and read-only after that. It
can be set by a spooler only.
If you are creating a message from the scratch, create it as an PostItem
rather than MailItem (it is created in a sent state), then reset the
MessageClass property back to IPM.Note. You cannot do this for an existing
MailItem.

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

> How can I set the sent flag (and sendername etc) for a newly created
> MailItem.
[quoted text clipped - 12 lines]
> oItem = (MailItem)mNameSpace.GetItemFromID(ID, oInbox.StoreID);
> Redemption.SafeMailItem sItem =

(Redemption.SafeMailItem)mApplicationObject.CreateObject("Redemption.SafeMai
> lItem");
> sItem.Item = oItem;
[quoted text clipped - 15 lines]
>
> Tim Attwood
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.