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 / June 2006

Tip: Looking for answers? Try searching our database.

Questioning Reply to all usign C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Carl Howarth - 30 Jun 2006 15:00 GMT
Hello,

I am trying to adapt the code provided here
(http://www.outlookcode.com/codedetail.aspx?id=1299) to be used in C# and
have managed to so far get the prompt to function correctly.

I can't however get the system to programatically remove the unrequired
recipients. As a second alternative I tried adding code to close the mail
message (something along the lines of MailMsg.close(discard constant) and
this did not work either. Here is the code - can anyone help?

<code>

       private void
Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
       {
           object Item = Inspector.CurrentItem;
           Microsoft.Office.Interop.Outlook.MailItem MailMsg;
   
           try
           {
               // Check the ItemsType
               if (Item is Microsoft.Office.Interop.Outlook.MailItem)
               {
                   MailMsg = (Microsoft.Office.Interop.Outlook.MailItem)Item;

                   if (MailMsg.Size == 0 && MailMsg.Recipients.Count > 1)
                   {
                       String Msg = "Do you really want to reply to all of
the original recipients?";
                       DialogResult res = MessageBox.Show(Msg, "Confirm
reply to all.", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                       if (res == DialogResult.No)
                       {
                           int count = MailMsg.Recipients.Count;

                           for (int i = 1; i < count; i++)
                           {
                               MailMsg.Recipients.Remove(i);
                           }
                       }
                   }
               }
           }
           catch (System.Exception ex)
           {
               MessageBox.Show(ex.Message);
           }
           finally
           {
               Item = null;
               MailMsg = null;
           }
       }

</code>

Thanks, Carl

Signature

Carl Howarth

Ken Slovak - [MVP - Outlook] - 30 Jun 2006 22:21 GMT
Use a down counting loop and save the item. Also try not to use NewInspector
that way, use the first Activate event. I've found some properties not fully
populated during NewInspector.

Signature

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

> Hello,
>
[quoted text clipped - 56 lines]
>
> Thanks, Carl
 
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.