A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Contacts
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Null Contacts returned from MAPFolder.Items



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 11th 06, 10:49 PM posted to microsoft.public.developer.outlook.addins,microsoft.public.outlook.contacts
[email protected]
external usenet poster
 
Posts: 5
Default Null Contacts returned from MAPFolder.Items

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  
Old May 12th 06, 03:16 PM posted to microsoft.public.developer.outlook.addins,microsoft.public.outlook.contacts
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Null Contacts returned from MAPFolder.Items

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  
Old May 12th 06, 05:39 PM posted to microsoft.public.developer.outlook.addins,microsoft.public.outlook.contacts
[email protected]
external usenet poster
 
Posts: 5
Default Null Contacts returned from MAPFolder.Items

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  
Old May 12th 06, 08:58 PM posted to microsoft.public.developer.outlook.addins,microsoft.public.outlook.contacts
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Null Contacts returned from MAPFolder.Items

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  
Old May 12th 06, 09:46 PM posted to microsoft.public.developer.outlook.addins,microsoft.public.outlook.contacts
[email protected]
external usenet poster
 
Posts: 5
Default Null Contacts returned from MAPFolder.Items

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  
Old May 15th 06, 05:21 PM posted to microsoft.public.developer.outlook.addins,microsoft.public.outlook.contacts
Alexa
external usenet poster
 
Posts: 1
Default Null Contacts returned from MAPFolder.Items

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
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


All times are GMT +1. The time now is 08:53 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-2025 Outlook Banter.
The comments are property of their posters.