J
JC
Hi...
Anybody knows what problem has this code? I think, in the Garbage Collector?
You know the Solution?
The program in the test's case, whit 350 contacts, run OK before number 86.
The error is a "Array index out of bounds".
Microsoft.Office.Interop.Outlook._Application olApp = new
Microsoft.Office.Interop.Outlook.ApplicationClass();
Microsoft.Office.Interop.Outlook._NameSpace olNs =
olApp.GetNamespace("MAPI");
Microsoft.Office.Interop.Outlook._Folders oFolders =
olNs.Folders;
Microsoft.Office.Interop.Outlook.MAPIFolder aContacts =
olNs.PickFolder();
Microsoft.Office.Interop.Outlook.Items oItems = aContacts.Items;
for (int i = 0; i <= x; oItems.Count)
{ //Explota en la proxima linea.
Microsoft.Office.Interop.Outlook._ContactItem oContact =
(Microsoft.Office.Interop.Outlook._ContactItem)oItems;
//Do something with oContact
oContact = null;
}
In this second case, the error appear in the line before the "for".
Microsoft.Office.Interop.Outlook._Application olApp = new
Microsoft.Office.Interop.Outlook.ApplicationClass();
Microsoft.Office.Interop.Outlook._NameSpace olNs =
olApp.GetNamespace("MAPI");
Microsoft.Office.Interop.Outlook._Folders oFolders =
olNs.Folders;
Microsoft.Office.Interop.Outlook.MAPIFolder aContacts =
olNs.PickFolder();
Microsoft.Office.Interop.Outlook.Items oItems = aContacts.Items;
int x = oItems.Count;
//Explota en la proxima linea.
for (int i = 0; i <= x; i++)
{
Microsoft.Office.Interop.Outlook._ContactItem oContact =
(Microsoft.Office.Interop.Outlook._ContactItem)oItems;
//Do something with oContact
oContact = null;
}
Anybody knows what problem has this code? I think, in the Garbage Collector?
You know the Solution?
The program in the test's case, whit 350 contacts, run OK before number 86.
The error is a "Array index out of bounds".
Microsoft.Office.Interop.Outlook._Application olApp = new
Microsoft.Office.Interop.Outlook.ApplicationClass();
Microsoft.Office.Interop.Outlook._NameSpace olNs =
olApp.GetNamespace("MAPI");
Microsoft.Office.Interop.Outlook._Folders oFolders =
olNs.Folders;
Microsoft.Office.Interop.Outlook.MAPIFolder aContacts =
olNs.PickFolder();
Microsoft.Office.Interop.Outlook.Items oItems = aContacts.Items;
for (int i = 0; i <= x; oItems.Count)
{ //Explota en la proxima linea.
Microsoft.Office.Interop.Outlook._ContactItem oContact =
(Microsoft.Office.Interop.Outlook._ContactItem)oItems;
//Do something with oContact
oContact = null;
}
In this second case, the error appear in the line before the "for".
Microsoft.Office.Interop.Outlook._Application olApp = new
Microsoft.Office.Interop.Outlook.ApplicationClass();
Microsoft.Office.Interop.Outlook._NameSpace olNs =
olApp.GetNamespace("MAPI");
Microsoft.Office.Interop.Outlook._Folders oFolders =
olNs.Folders;
Microsoft.Office.Interop.Outlook.MAPIFolder aContacts =
olNs.PickFolder();
Microsoft.Office.Interop.Outlook.Items oItems = aContacts.Items;
int x = oItems.Count;
//Explota en la proxima linea.
for (int i = 0; i <= x; i++)
{
Microsoft.Office.Interop.Outlook._ContactItem oContact =
(Microsoft.Office.Interop.Outlook._ContactItem)oItems;
//Do something with oContact
oContact = null;
}