> 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
>
> --
> Carl Howarth