Thread: Delete MailItem
View Single Post
  #3  
Old January 24th 07, 06:59 AM posted to microsoft.public.outlook.program_addins
j
external usenet poster
 
Posts: 109
Default Delete MailItem


Thanks for replay,

After calling to Delete() method does pointer to mailItem still
remain?, suppose i call to Delete() in mailItem
that exists in Recycle folder.

TNX.


On Jan 23, 8:38 pm, "Ken Slovak - [MVP - Outlook]"
wrote:
You should always release objects when done with them. I'd put the nulling
of the object before calling to release the COM object though. I don't see
any need for DoEvents given the code you showed.

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm

"j" wrote in ooglegroups.com...



Hi,


While i delete MailItem ( myMailItem.Delete() ) should i also call
ReleaseComObject,
and is it good idea to call Application.DoEvents after deleting item??


please review the code snippets:


...............
..........
............
mailItem.Delete();
Application.DoEvents();


Marshal.ReleaseComObject(mailItem);
mailItem = null;


.....................
.............................


is it right way ???


TNX in advance;- Hide quoted text -- Show quoted text -


Ads