![]() |
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'm new to OL programming, am using C#, and am having an issue...
We have a Public Folder that contains a Contacts form with approximately 5,000 contacts. We want to export this to an Excel report programmatically. Using Outlook.MAPIFolder.Folders[MY_FOLDER].Items.Count shows the correct number of items, but when looping through these items after about 2,000 they all end up being null. I've found a few topics on this problem, but none seem to address the problem I'm having. Is there a limit to the number of Items that can be returned from the folder? Does anyone know a solution for this? ANY help would be greatly appreciated!!! My code: Outlook.MAPIFolder aFolder = mapiNamespace.GetDefaultFolder(Outlook.OlDefaultFo lders.olPublicFoldersAllPublicFolders).Folders["My Folder"] Items items = aFolder.Items; int itemCount = items.Count; object item = items.GetFirst(); for(int i = 0; i itemCount; i++) { ContactItem cItem = item as ContactItem; if (cItem != null) { itemInfo[0] = cItem.LastName; itemInfo[1] = cItem.FirstName; itemInfo[2] = cItem.CompanyName; ... } allItems.Add(itemInfo); itemInfo = new String[9]; item = items.GetNext(); } |
Ads |
#2
|
|||
|
|||
![]()
I'm not sure this is it, but I vaguely recall a problem with the Getxxx
constructs. See if using a direct assignment works: item = items[i] -- 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 wrote in message oups.com... I'm new to OL programming, am using C#, and am having an issue... We have a Public Folder that contains a Contacts form with approximately 5,000 contacts. We want to export this to an Excel report programmatically. Using Outlook.MAPIFolder.Folders[MY_FOLDER].Items.Count shows the correct number of items, but when looping through these items after about 2,000 they all end up being null. I've found a few topics on this problem, but none seem to address the problem I'm having. Is there a limit to the number of Items that can be returned from the folder? Does anyone know a solution for this? ANY help would be greatly appreciated!!! My code: Outlook.MAPIFolder aFolder = mapiNamespace.GetDefaultFolder(Outlook.OlDefaultFo lders.olPublicFoldersAllPublicFolders).Folders["My Folder"] Items items = aFolder.Items; int itemCount = items.Count; object item = items.GetFirst(); for(int i = 0; i itemCount; i++) { ContactItem cItem = item as ContactItem; if (cItem != null) { itemInfo[0] = cItem.LastName; itemInfo[1] = cItem.FirstName; itemInfo[2] = cItem.CompanyName; ... } allItems.Add(itemInfo); itemInfo = new String[9]; item = items.GetNext(); } |
#3
|
|||
|
|||
![]()
Yeah, I tried that already. It's actually the first way I tried to
access the items. When I kept receiving the null values, I thought maybe the direct assignment was the problem, so I switched to looping through with the GetNext() method. |
#4
|
|||
|
|||
![]()
No idea then. It's not the famous 250 limit where you're limited to about
250 or so RPC channels, that would hit you much faster. -- 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 wrote in message oups.com... Yeah, I tried that already. It's actually the first way I tried to access the items. When I kept receiving the null values, I thought maybe the direct assignment was the problem, so I switched to looping through with the GetNext() method. |
#5
|
|||
|
|||
![]()
Hi Ken,
Thanks for you help. I think it actually was the 255 RPC channel limit. Someone recommended invoking the GC, which seemed to do the trick. I'm not sure why I was getting back several thousand items before this limit hit its threshold, though. But, then again, GC seems to be a bit fickle anyway, so it's not surprising. Thanks! Leah Ann |
#6
|
|||
|
|||
![]()
Yes, I got the same problem when I was doing the same thing. I solved it by
sleeping the thread for every 5 contacts or so and then call the GC to clean up the memory residue. Alexa wrote in message oups.com... Hi Ken, Thanks for you help. I think it actually was the 255 RPC channel limit. Someone recommended invoking the GC, which seemed to do the trick. I'm not sure why I was getting back several thousand items before this limit hit its threshold, though. But, then again, GC seems to be a bit fickle anyway, so it's not surprising. Thanks! Leah Ann |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
30 of 89 mailings are returned too many recipients? Why? | lexluther | Outlook - Using Contacts | 1 | April 4th 06 10:33 AM |
Please help with returned emails from new domain | JM | Outlook - General Queries | 7 | March 14th 06 05:06 PM |
Error report on returned mail. | Buiskop19 | Outlook Express | 13 | February 24th 06 02:26 PM |
messaging interface returned an unknown error | phil | Outlook - Installation | 0 | January 17th 06 03:06 PM |
Blank form returned | brianlowry | Outlook - Using Forms | 1 | January 11th 06 08:41 AM |