D
DaveUK
Hi,
I am having problems with the MailItem.Reply() method in a VSTO add-in for
Outlook 2007.
If I make a very simple Add-In with a button that simply does something like:
------------------
Outlook.MailItem selectedMail = explorer.Selection[1] as MailItem;
if (selectedMail != null) {
Outlook.MailItem newMail = selectedMail.Reply();
newMail.Display(false);
}
------------------
Then the reply MailItem ('newMail' in the example) opens with its Saved
property set to false.
This has the effect that closing this MailItem causes a dialog to display
with the text 'Do you want to save changes?', despite not actually making any
changes.
The Saved property is readonly, so I can't set it to true just after I call
Reply().
The only way to change it appears to be by saving the reply MailItem to the
drafts.
This will cause a useless draft to be saved each time, unless I delete them
programmatically, which will send them to the deleted items... And things
begin to get complicated from a very simple problem.
The standard Reply button in Outlook seems to be able to reply fine and
close immediately if no changes are made, so I would expect to be able to do
the same in a custom Add-In.
Any help would be greatly appreciated.
--
Thanks,
Dave
PS. If it seems like this is a very minor problem and that I am being
nitpicky, this is actually part of a larger bug that I am seeking to prevent.
I am having problems with the MailItem.Reply() method in a VSTO add-in for
Outlook 2007.
If I make a very simple Add-In with a button that simply does something like:
------------------
Outlook.MailItem selectedMail = explorer.Selection[1] as MailItem;
if (selectedMail != null) {
Outlook.MailItem newMail = selectedMail.Reply();
newMail.Display(false);
}
------------------
Then the reply MailItem ('newMail' in the example) opens with its Saved
property set to false.
This has the effect that closing this MailItem causes a dialog to display
with the text 'Do you want to save changes?', despite not actually making any
changes.
The Saved property is readonly, so I can't set it to true just after I call
Reply().
The only way to change it appears to be by saving the reply MailItem to the
drafts.
This will cause a useless draft to be saved each time, unless I delete them
programmatically, which will send them to the deleted items... And things
begin to get complicated from a very simple problem.
The standard Reply button in Outlook seems to be able to reply fine and
close immediately if no changes are made, so I would expect to be able to do
the same in a custom Add-In.
Any help would be greatly appreciated.
--
Thanks,
Dave
PS. If it seems like this is a very minor problem and that I am being
nitpicky, this is actually part of a larger bug that I am seeking to prevent.