Outlook 97 Cancel Write

J

Julieta Prandi

Hi Guys,
I'm trying to cancel the write operation of a message in Outlook 97.
The event MailItem.Write doesn't have parameters as in Outlook 2k and higher
to handle the operation.
I tried using IExchExtMessageEvents:OnWrite event: I return S_OK to handle
the operation by myself but it doesn't work. Outlook saves the message
marked as read instead of unread (if I return S_FALSE it is marked as
unread). The point is that Outlook believes that the message wasn't saved
because it prompts the 'do you want to save changes' dialog but the message
is saved.

Do you know ANY way to workaround this problem?

Thank you a lot!
(-- Julieta --)
 
J

Julieta Prandi

What I really need is to change the parent folder of the mail item so when
it is saved by the user the message should be saved in a specific folder.
I tried using
mailItem = specialFolder->Items->Add("IPM.Note.CustomB");
but the message is saved in inbox.
I saw a parent property of the mailItem but is read only.
 
D

Dmitry Streblechenko

You cannot change the message parent a-la, say, Subject property. You can
either move the message (MailItem.Move) or create a new message in the
target folder, copy all properties from the old message there, then delete
the original.
Outlook does not expect that you will do something drastic to the message it
is displaying or otherwise working with.
Wait until Outlook is done, then move the message

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
J

Julieta Prandi

Hi Dmitry,
Finally, I did that but a lot of messages in the deleted items appears so I
had to add a special tag to delete the messages that were created there.
I'm looking for a better solution if any.

Thanks,
(-- Julieta --)
 
D

Dmitry Streblechenko

Why did you use OOM to delete the messages? Either use OOM to move the
messages (MailItem.Move) or delete them using Extended MAPI
(IMAPIFolder.DeleteMessages)

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
D

Dmitry Streblechenko

It does exist. IMAPIFolder.DeleteMessages was introduced back in the
Exchange Client days, before Outlook 97.
This is an Extended MAPI method, not OOM.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
J

Julieta Prandi

Ah, that's why I didn't find it.
Right now, everything is working fine with the workaround so I'll keep it in
this way.

Thank you for your help.
(-- Julieta --)
 

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