How to delte a mail in Outlook?

N

Nils

Hi,

i try to develop a Outlook Com-Addin, which makes some things with the
selected mailitems after pressing my custom button (like Reading the Subject,
save attachments, remove attachments,..), which all works fine. After all
this i want to delete the mail, but when i call mailitem.delete() i get a
error message, that outlook cannot delete this mail. Why? What have i to do
before i can delete a mail?

I'm using c# and VS2005.

Thanks for any answers
Nils
 
K

Ken Slovak - [MVP - Outlook]

Usually you can delete anything unless you have it open somewhere else and
have live objects referencing that object other than "mailitem".

What specific error are you getting, have you googled it?
 
N

Nils

The Error Message is "Outlook kann dieses Element nicht löschen", its a
german installation, in english is must be something like "Outlook cannot
delete this element".
The Exception Trace is the following:
Informationen über das Aufrufen von JIT-Debuggen
anstelle dieses Dialogfelds finden Sie am Ende dieser Meldung.

************** Ausnahmetext **************
System.Runtime.InteropServices.COMException (0x96A20009): Outlook kann
dieses Element nicht löschen.
bei Outlook._MailItem.Delete()
bei Bremion.Windexer2.Mail.frmSelectFolder.cancelArchivation()
bei Bremion.Windexer2.Mail.uctrlMessage.cmdNo_Click(Object sender,
EventArgs e)
bei System.Windows.Forms.Control.OnClick(EventArgs e)
bei System.Windows.Forms.Button.OnClick(EventArgs e)
bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei System.Windows.Forms.ButtonBase.WndProc(Message& m)
bei System.Windows.Forms.Button.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

It semms that it works on a Outlook 2000 Client, but not on a Outlook 2003
Installation.
 
K

Ken Slovak - [MVP - Outlook]

I'm sorry, that trace doesn't really tell me much about why it's not
working.

What PIA are you using? Are you trying to use the Outlook 2000 custom PIA
you created with Outlook 2003? That's not a good idea.
 

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