Iterating through folder items causes unknown error after 250 items

D

Dean Rosenhain

Hi
I have a form that iterates through a folder's items and collects fields
into an array for later display/reporting.

On my test environment (OL2010/Ex2007) all works fine, but in an
environment with OL2003/Ex2003 the routine gets to around 245 to 250 items
and halts with an untrappable "Unknown Error" when trying to access a
property in the item.

I gather the cause is something to do with a limit (such as RPC calls or
undisposed objects), but I'm looking for possible work arounds.

A code snippet is below:

sFilter="[Message Class] = 'IPM.Contact.MyContact' AND
[BusinessAddressState]='VIC' "

set RestrictItems = MyItems.Restrict(sFilter)
RestrictItems.Sort "[LastName]", True

n=0
ReportData(0, n) = "Selected"
ReportData(1, n) = "Title"
ReportData(2, n) = "FirstName"
ReportData(3, n) = "LastName"
n=1

for each i in RestrictItems
ReportData(0, n) = n
ReportData(1, n) = i.Title '<<<<---- Dies here!
ReportData(2, n) = i.FirstName
ReportData(3, n) = i.LastName
n=n+1
next
set MyItems = Nothing

Any suggestions would be gratefully received!
Dean
 
K

Karthikeyan D

Hi,
I have a similar issue while getting the CustomerID from the folder items, There is an unknown error accessing the outlook property.
Please let me know if you got a solution for this.

Thanks in advance.
Hi
I have a form that iterates through a folder's items and collects fields
into an array for later display/reporting.

On my test environment (OL2010/Ex2007) all works fine, but in an
environment with OL2003/Ex2003 the routine gets to around 245 to 250 items
and halts with an untrappable "Unknown Error" when trying to access a
property in the item.

I gather the cause is something to do with a limit (such as RPC calls or
undisposed objects), but I am looking for possible work arounds.

A code snippet is below:

sFilter="[Message Class] = 'IPM.Contact.MyContact' AND
[BusinessAddressState]='VIC' "

set RestrictItems = MyItems.Restrict(sFilter)
RestrictItems.Sort "[LastName]", True

n=0
ReportData(0, n) = "Selected"
ReportData(1, n) = "Title"
ReportData(2, n) = "FirstName"
ReportData(3, n) = "LastName"
n=1

for each i in RestrictItems
ReportData(0, n) = n
ReportData(1, n) = i.Title '<<<<---- Dies here!
ReportData(2, n) = i.FirstName
ReportData(3, n) = i.LastName
n=n+1
next
set MyItems = Nothing

Any suggestions would be gratefully received!
Dean

--

______________________________________
Posted from http://outlook-center.com
Outlook forums, articles, tips.
 
Top