A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - General Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

using outlook object model to add a MailItem to the Sent Items folder



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 22nd 07, 06:14 AM posted to microsoft.public.outlook
Omatase
external usenet poster
 
Posts: 4
Default using outlook object model to add a MailItem to the Sent Items folder

I want to add a MailItem directly to the Sent Items folder. I don't
want to actually 'send' the email. The purpose of adding the email to
the Sent Items folder is just to show that it was actually sent at
some point. The email was in fact already sent by another application
previously.

Here is the code I have tried to use, the problem I am having is that
the MailItem will only make it to the Drafts folder.

Microsoft.Office.Interop.Outlook.MAPIFolder outBoxfolder =
_MAPINamespace.GetDefaultFolder(Microsoft.Office.I nterop.Outlook.OlDefaultFolders.olFolderSentMail);

Microsoft.Office.Interop.Outlook.MailItem mailItem =
(Microsoft.Office.Interop.Outlook.MailItem)outBoxf older.Items.Add(Microsoft.Office.Interop.Outlook.O lItemType.olMailItem);

mailItem.Body = "test";
mailItem.To = ";
mailItem.Subject = "subject";

mailItem.Save();

mailItem.Close(OlInspectorClose.olSave);

Ads
  #2  
Old July 22nd 07, 06:29 AM posted to microsoft.public.outlook
Milly Staples [MVP - Outlook]
external usenet poster
 
Posts: 4,696
Default using outlook object model to add a MailItem to the Sent Items folder

This type of question can best be answered by those who are more experienced with programming in Outlook,

You may want to post this in the microsoft.public.outlook.program_forms group for Outlook 98 or in the microsoft.public.outlook.program_vba group for Outlook 2000.

You will probably receive a faster and more expert answer over there.

--
Milly Staples [MVP - Outlook]

Post all replies to the group to keep the discussion intact. All
unsolicited mail sent to my personal account will be deleted without
reading.

After furious head scratching, Omatase asked:

| I want to add a MailItem directly to the Sent Items folder. I don't
| want to actually 'send' the email. The purpose of adding the email to
| the Sent Items folder is just to show that it was actually sent at
| some point. The email was in fact already sent by another application
| previously.
|
| Here is the code I have tried to use, the problem I am having is that
| the MailItem will only make it to the Drafts folder.
|
| Microsoft.Office.Interop.Outlook.MAPIFolder outBoxfolder =
| _MAPINamespace.GetDefaultFolder(Microsoft.Office.I nterop.Outlook.OlDefaultFolders.olFolderSentMail);
|
| Microsoft.Office.Interop.Outlook.MailItem mailItem =
| (Microsoft.Office.Interop.Outlook.MailItem)outBoxf older.Items.Add(Microsoft.Office.Interop.Outlook.O lItemType.olMailItem);
|
| mailItem.Body = "test";
| mailItem.To = ";
| mailItem.Subject = "subject";
|
| mailItem.Save();
|
| mailItem.Close(OlInspectorClose.olSave);
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why does the Address property of the Recipient object in the Outlook object model look funny? Omatase Outlook - General Queries 2 July 13th 07 09:09 PM
Outlook Object Model Threading MON205 Outlook - General Queries 8 May 6th 07 04:37 PM
Outlook Object Model Threading MON205 Add-ins for Outlook 8 May 6th 07 04:37 PM
Outlook object model guard Mark Priem Outlook and VBA 7 January 3rd 07 06:41 PM
How to redistribute Outlook Object Model? papachina Outlook and VBA 5 September 11th 06 07:14 PM


All times are GMT +1. The time now is 07:58 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.