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 Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Your server administrator has limited the number of items you can



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 20th 10, 04:21 AM posted to microsoft.public.outlook.program_forms
spottedmahn
external usenet poster
 
Posts: 16
Default Your server administrator has limited the number of items you can

I'm receiving the following COMException:

"Your server administrator has limited the number of items you can open
simultaneously. Try closing messages you have opened or removing attachments
and images from unsent messages you are composing."

when I try to iterate thru a list of Contact Items.

I've read a few posts on this same error message but I'm still unsure how of
how to properly fix it.

Here is my code:

ListContactItem Results = new ListContactItem();

Outlook.Items Contacts = this.WcmsContactsMapiFolder.Items;

Outlook.ContactItem Contact = (Outlook.ContactItem)
Contacts.GetFirst();

do
{
ContactItem NewCont =
ContactItem.FromOutlookContactItem(Contact, this.SifApp);

Results.Add(NewCont);

Marshal.ReleaseComObject(Contact);

Contact = (Outlook.ContactItem)Contacts.GetNext();

} while (Contact != null);

return Results;

I've read posts that say you must call " Marshal.ReleaseComObject()" but
that doesn't appear to be closing the connection.

I've read posts that say to increase the simultaneous connection limit but
that doesn't see right to me. I'm able to view the contact list in Outlook
so it is reading it somehow.


Ads
  #2  
Old May 20th 10, 03:03 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Your server administrator has limited the number of items you can

Declare NewCont outside the loop so you aren't creating an instance of it
each pass through the loop. Set both contact objects to null, if that's not
enough to prevent the error then call Marshal.ReleaseComObject() on them. If
that's not enough then call the GC and WaitForPendingFinalizers(). Do it in
steps so you don't add more handling than the minimum needed. Using
ReleaseComObject() and the garbage collection is expensive.

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


"spottedmahn" wrote in message
...
I'm receiving the following COMException:

"Your server administrator has limited the number of items you can open
simultaneously. Try closing messages you have opened or removing
attachments
and images from unsent messages you are composing."

when I try to iterate thru a list of Contact Items.

I've read a few posts on this same error message but I'm still unsure how
of
how to properly fix it.

Here is my code:

ListContactItem Results = new ListContactItem();

Outlook.Items Contacts = this.WcmsContactsMapiFolder.Items;

Outlook.ContactItem Contact = (Outlook.ContactItem)
Contacts.GetFirst();

do
{
ContactItem NewCont =
ContactItem.FromOutlookContactItem(Contact, this.SifApp);

Results.Add(NewCont);

Marshal.ReleaseComObject(Contact);

Contact = (Outlook.ContactItem)Contacts.GetNext();

} while (Contact != null);

return Results;

I've read posts that say you must call " Marshal.ReleaseComObject()" but
that doesn't appear to be closing the connection.

I've read posts that say to increase the simultaneous connection limit but
that doesn't see right to me. I'm able to view the contact list in
Outlook
so it is reading it somehow.



  #3  
Old May 21st 10, 06:01 AM posted to microsoft.public.outlook.program_forms
spottedmahn
external usenet poster
 
Posts: 16
Default Your server administrator has limited the number of items you

Hi Ken, thanks for the reply.

The point of the loop is to convert Outlook Contacts objects to My Custom
Contact Objects so it doesn't make sense to declare NewCont outside the loop.
Maybe I'm mis-understanding you?

I've seen similar suggestions in other forum posts and it seems like a cross
your fingers and hope solution which doesn't make me feel very comfortable.

It seems like there should be a reliable way of "closing" objects that you
open. Am I missing something?

Thanks,
Mike D.

"Ken Slovak - [MVP - Outlook]" wrote:

Declare NewCont outside the loop so you aren't creating an instance of it
each pass through the loop. Set both contact objects to null, if that's not
enough to prevent the error then call Marshal.ReleaseComObject() on them. If
that's not enough then call the GC and WaitForPendingFinalizers(). Do it in
steps so you don't add more handling than the minimum needed. Using
ReleaseComObject() and the garbage collection is expensive.

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



  #4  
Old May 21st 10, 02:38 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Your server administrator has limited the number of items you

Yes, if you don't follow the advice you've seen from me and other posters
you are missing something. If you follow the advice you won't have those
problems.

Declaring the NewCont object outside the loop creates only 1 of those
objects. You just set it and reset it inside the loop. If you declare it
inside the loop and the loop executes 200 times you just created 200 of
those objects.

You can still do what you want, and then have to use
Marshal.ReleaseComObject() on each object plus setting each object to null,
then calling GC and WaitForPendingFinalizers on each pass through the loop.
That will also work, but the performance of loop execution will suffer a
lot. What I recommended is a balance of getting the loop to work and having
it work as fast as possible.

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


"spottedmahn" wrote in message
...
Hi Ken, thanks for the reply.

The point of the loop is to convert Outlook Contacts objects to My Custom
Contact Objects so it doesn't make sense to declare NewCont outside the
loop.
Maybe I'm mis-understanding you?

I've seen similar suggestions in other forum posts and it seems like a
cross
your fingers and hope solution which doesn't make me feel very
comfortable.

It seems like there should be a reliable way of "closing" objects that you
open. Am I missing something?

Thanks,
Mike D.


  #5  
Old May 21st 10, 06:06 PM posted to microsoft.public.outlook.program_forms
spottedmahn
external usenet poster
 
Posts: 16
Default Your server administrator has limited the number of items you

Hi Ken, thanks again for the reply.

I'm still not clear on your analysis of declaring NewCont outside the loop.
Whether I put NewCont inside or outside the loop N objects will be created.

The point of the loop is to take a Outlook Contact and create a Custom
Contact Object. Therefore for every Outlook Contact object there will be one
Custom Contact Object.

So if I have 200 Outlook Contacts in a MapiFolder the above code would
return a ListCustomContactObject whose count is 200. Make sense?

As for setting each object to null I'm unclear on how that would effect
anything. With each iteration of the loop the variables are re-assigned to
other objects.

So on Pass 1 Contact = X, then on Pass 2 Contact = Y. Nothing points to X
anymore.

I'm not trying to be combative I'm just trying to understand.

Thanks for you input,
Mike D.

"Ken Slovak - [MVP - Outlook]" wrote:

Yes, if you don't follow the advice you've seen from me and other posters
you are missing something. If you follow the advice you won't have those
problems.

Declaring the NewCont object outside the loop creates only 1 of those
objects. You just set it and reset it inside the loop. If you declare it
inside the loop and the loop executes 200 times you just created 200 of
those objects.

You can still do what you want, and then have to use
Marshal.ReleaseComObject() on each object plus setting each object to null,
then calling GC and WaitForPendingFinalizers on each pass through the loop.
That will also work, but the performance of loop execution will suffer a
lot. What I recommended is a balance of getting the loop to work and having
it work as fast as possible.

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

  #6  
Old May 24th 10, 07:10 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Your server administrator has limited the number of items you

If you declare an object outside the loop

Outlook.ContactItem NewCont = null;

and then instantiate instances of it within the loop you are only creating
one object. You are assigning an instance of that object each time through
the loop, then you set it to null/release. Next time through you are just
instantiating another instance of that object.

If you declare the object inside the loop you create one object each pass
through the loop, then instantiate it then release it.

Those 2 are not identical scenarios.

If you don't release the objects then they remain in memory until some
undetermined time in the future when the garbage collector finally runs
after the items go out of scope. The RPC channels remain committed until
those objects are released. Therefore you get the errors you described.

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


"spottedmahn" wrote in message
...
Hi Ken, thanks again for the reply.

I'm still not clear on your analysis of declaring NewCont outside the
loop.
Whether I put NewCont inside or outside the loop N objects will be
created.

The point of the loop is to take a Outlook Contact and create a Custom
Contact Object. Therefore for every Outlook Contact object there will be
one
Custom Contact Object.

So if I have 200 Outlook Contacts in a MapiFolder the above code would
return a ListCustomContactObject whose count is 200. Make sense?

As for setting each object to null I'm unclear on how that would effect
anything. With each iteration of the loop the variables are re-assigned
to
other objects.

So on Pass 1 Contact = X, then on Pass 2 Contact = Y. Nothing points to X
anymore.

I'm not trying to be combative I'm just trying to understand.

Thanks for you input,
Mike D.


 




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
Limited number of columns Pavel Outlook - Calandaring 0 July 8th 08 05:34 PM
Your server administrator has limited the number of items you can Johan Verrept Outlook and VBA 3 March 13th 08 04:57 PM
Your server administrator has limited the number of items you can Johan Verrept Add-ins for Outlook 3 March 13th 08 04:57 PM
When exporting Outlook 2007 Contacts inly a limited number go. mcfarmer Outlook - Using Contacts 2 October 26th 07 09:01 PM
You server administrator has limited ... Brian Ross Outlook - General Queries 1 April 10th 07 02:07 PM


All times are GMT +1. The time now is 10:19 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.