access to the items in .pst and exchange behave differently

A

Alexander

Environment

server: SBS2003SP1/ExchangeSP2/McAfee antivirus
workstation: WinXP SP2/Outlook 2003 in cashed mode/Norton AV/VS2005

I have 2 identical sets of tasks, one in the .pst file in my home folder on
the server, second in the Exchange in my profile.

Code below will enumerate all task from .pst with out problems. But when I
will try to enumerate task from Exchange task folder, some of the object
will come back as null.
So far my guess that server antivirus some how has affecting enumeration,
but I will greatly appreciate any another suggestions.

Outlook.Application objOutlook = new Outlook.ApplicationClass();
Outlook.NameSpace objNS = objOutlook.GetNamespace("MAPI");

Outlook.MAPIFolder folder = objNS.PickFolder(); // I will select task folder

int total = 0;
int bad = 0;
int good = 0;
foreach (object obj in folder.Items)
{
Outlook.TaskItem item = obj as Outlook.TaskItem;
total++;
if (item == null)
{
bad++;
}
else
{
good++;
}
}

Sincerely,
Alexander
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top