![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I am trying to open/read all email in the inbox.. (trying to delete duplicates)
Get error at 250th item sayin the system settings do not allow any more open than that have this in code ' need to close the email oMsg.Close(OlInspectorClose.olSave) but does not close the mail item how do I close properly so no error |
Ads |
#2
|
|||
|
|||
![]()
Managed code with Exchange mailbox? That's the RPC channel limit, unless the
object reference is released that error will result after about 250 or so operations. Set the object to null each pass through the code, if necessary also call Marshal.ReleaseComObject() on it and GC.Collect(). That will release all those RPC channels that otherwise wouldn't be released until the procedure ended and the objects went out of scope. Also don't use concatenated dot operators: string body = olApp.ActiveInspector.CurrentItem.Body; Set up a variable for each dot operator so you can explicitly release things. Otherwise intrinsic variables are created internally and you cannot release those: Outlook.Inspector insp = olApp.ActiveInspector; Outlook.MailItem item = (Outlook.MailItem)insp.CurrentItem; string body = item.Body; -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Richard Elgert" relgert[at]tct-inc[dot]com wrote in message ... I am trying to open/read all email in the inbox.. (trying to delete duplicates) Get error at 250th item sayin the system settings do not allow any more open than that have this in code ' need to close the email oMsg.Close(OlInspectorClose.olSave) but does not close the mail item how do I close properly so no error Submitted using http://www.outlookforums.com |
#3
|
|||
|
|||
![]()
retValue = System.Runtime.InteropServices.Marshal.ReleaseComO bject(oMsg )
GC.Collect() OK I did add the above 2 lines and the 250 limit error is gone.... but I am not sure I fully understand... (will your book clarify) and a follow up, I need to browse all folders and sub-folders in a users mailbox. . Submitted using http://www.outlookforums.com |
#4
|
|||
|
|||
![]()
My book might mention the RPC limit but it's strictly an Exchange setting
that's controlled by a registry setting on the server. It limits how many RPC channels any application can open at any one time so as not to bog down the server. Since the setting can be anything if the admins change the default, all you really need to understand is to follow best practices and release your objects as soon as they are not needed and not to create intrinsic object variables by using compound dot operators, especially within loops where the objects will persist until the procedure running the loop has ended. I don't understand your question about folder browsing. Just use a recursive procedure that digs into each MAPIFolder.Folders collection, starting with the NameSpace.Folders collection or at a selected starting point. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Richard Elgert" relgert[at]tct-inc[dot]com wrote in message ... retValue = System.Runtime.InteropServices.Marshal.ReleaseComO bject(oMsg ) GC.Collect() OK I did add the above 2 lines and the 250 limit error is gone.... but I am not sure I fully understand... (will your book clarify) and a follow up, I need to browse all folders and sub-folders in a users mailbox. . Submitted using http://www.outlookforums.com |
#5
|
|||
|
|||
![]()
Well to make a long story short... the whole purpose of this exercise was to delete duplicate emails... from several import of lotus Notes int Outlook, we wound up with hundreds of dupes. Tried the 'ODIR' recommended program, but that did not delete them... my code test showed that they all had a unique record ID.
Bought "Duplicate Email Remover" for $30 dollars and that did the job just fine... I will work on my code when time permits.... Submitted using http://www.outlookforums.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
When I close an email item, the whole program shuts down. | Beckiet | Outlook - General Queries | 1 | March 9th 09 11:11 PM |
Alternative to item.close | flaterp | Outlook - Using Forms | 3 | October 29th 08 06:44 PM |
Function Item.close Outlook 2007 | JCCKIKI | Outlook - Using Forms | 2 | October 3rd 07 12:01 PM |
Outlook 2007 and Item.Close | slbergh | Outlook - Using Forms | 2 | June 8th 07 07:11 AM |
Item.Save and Item.Close Script causes Outlook 2007 to Crash | Rayyan | Outlook - Using Forms | 6 | November 25th 06 04:14 AM |