Problems with Reply() in Outlook 2007 Add-in

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.
 
K

Ken Slovak - [MVP - Outlook]

That's the way it works and has, Outlook 2003 is the same way. You just have
to work around the problem.
 
D

DaveUK

Thanks for your swift reply, Ken.

It is a little bizarre, but I guess I can work around it.

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top