L
leahann
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.OlDefaultFolders.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();
}
Thanks!
leahann
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.OlDefaultFolders.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();
}
Thanks!
leahann