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