![]() |
|
Deleted Items
All that means is that something is holding a reference to the original item
and it's taking a while for it to go away. That's classic behavior for something that's finally getting hit by the garbage collector and not being fully released until then. You're going to have to put your detective's hat on to find what that is. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Rog" wrote in message ... Yes it seems if I do wait some period of time after deleting an item from the contacts folder it will be picked up that it has moved into the Deleted Items Folder. What is odd too is, I used OutlookSpy to look at PR_PARENT_ENTRYID and it shows the deleted items folder enntry, but if I use the same in my code: safeMailitem.get_Fields(235471106); it will return the entryid of the Contacts folder. |
Deleted Items
thanks Ken, do you have any suggestions or tools that may help me to
figure that out? Ken Slovak - [MVP - Outlook] wrote: All that means is that something is holding a reference to the original item and it's taking a while for it to go away. That's classic behavior for something that's finally getting hit by the garbage collector and not being fully released until then. You're going to have to put your detective's hat on to find what that is. |
Deleted Items
No, not really. It's a matter of looking over each line of your code with a
microscope and checking for creation of implicit variables (from using compound dot operators instead of explicitly declared variables for each dot operator), making sure everything is explicitly released instead of relying on things to go out of scope and other best practices. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Rog" wrote in message ... thanks Ken, do you have any suggestions or tools that may help me to figure that out? |
Deleted Items
OK so for example if I get a list of contacts like
GetNamespace("MAPI").GetDefaultFolder(OlDefaultFol ders.olFolderContacts).Items; and I use it, do I need to release it when I am done with these items? Also if I say: object item = GetFolderFromId(entry, store); do I need to release this item and garbage collect everytime when I am done with it? rog Ken Slovak - [MVP - Outlook] wrote: No, not really. It's a matter of looking over each line of your code with a microscope and checking for creation of implicit variables (from using compound dot operators instead of explicitly declared variables for each dot operator), making sure everything is explicitly released instead of relying on things to go out of scope and other best practices. |
Deleted Items
Also do you have a place to go where I can learn these best practices?
Rog Ken Slovak - [MVP - Outlook] wrote: No, not really. It's a matter of looking over each line of your code with a microscope and checking for creation of implicit variables (from using compound dot operators instead of explicitly declared variables for each dot operator), making sure everything is explicitly released instead of relying on things to go out of scope and other best practices. |
Deleted Items
I would break that up so no implicit object variables are created. In VB 6
syntax: Dim oNS As Outlook.NameSpace Dim oFolder As Outlook.MAPIFolder Dim colItems As Outlook.Items Set oNS = oOL.GetNameSpace("MAPI") Set oFolder = oNS.GetDefaultFolder(olFolderContacts) Set colItems = oFolder.Items I would explicitly release objects as soon as they are no longer needed. I would minimize the calls to the garbage collector until they are needed, perhaps in the shutdown code and whenever you need to ensure that no cached object references are being maintained. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Rog" wrote in message ... OK so for example if I get a list of contacts like GetNamespace("MAPI").GetDefaultFolder(OlDefaultFol ders.olFolderContacts).Items; and I use it, do I need to release it when I am done with these items? Also if I say: object item = GetFolderFromId(entry, store); do I need to release this item and garbage collect everytime when I am done with it? rog |
Deleted Items
Look at the information at
http://www.microeye.com/resources/res_outlookvsnet.htm -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Rog" wrote in message ... Also do you have a place to go where I can learn these best practices? Rog Ken Slovak - [MVP - Outlook] wrote: No, not really. It's a matter of looking over each line of your code with a microscope and checking for creation of implicit variables (from using compound dot operators instead of explicitly declared variables for each dot operator), making sure everything is explicitly released instead of relying on things to go out of scope and other best practices. |
Deleted Items
As always thank you Ken.
I am wondering I tried adding: try { while (System.Runtime.InteropServices.Marshal.ReleaseCom Object(contactItem) 0); contactItem = null; } catch(System.Exception ex) { GlobalConstants.Log(log, "Error", "ReleasingComObjects", ex); } but sometimes it seems that while I am trying to do my processing I lose reference to my object even though it was created after this. Any ideas? Thanks, Rog Ken Slovak - [MVP - Outlook] wrote: Look at the information at http://www.microeye.com/resources/res_outlookvsnet.htm |
Deleted Items
I have no idea.
-- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Rog" wrote in message ... As always thank you Ken. I am wondering I tried adding: try { while (System.Runtime.InteropServices.Marshal.ReleaseCom Object(contactItem) 0); contactItem = null; } catch(System.Exception ex) { GlobalConstants.Log(log, "Error", "ReleasingComObjects", ex); } but sometimes it seems that while I am trying to do my processing I lose reference to my object even though it was created after this. Any ideas? Thanks, Rog |
Deleted Items
Just an update:
Thanks so Ken and Dmitry's guidance I have solved the deleted items problem It definately was items being held in memory. The point where I found where my items were being held in memory was when I use the InspectorWrapper. On close of the inspector I was not releasing the items from memory. Thanks guys. Ken Slovak - [MVP - Outlook] wrote: I have no idea. |
All times are GMT +1. The time now is 03:21 PM. |
|
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com