C
Cmon
I'm using outlook interop version 11. The outlook is 2003. The code is in c# .net, console application. It works on my computer, but when I put it on the server, it can't read the mailitem.
When I tried it on the server, I can find all of the item that fits with the filter., say, I found 3 emails out of 20000 emails.
When I use
It can't find the email that I'm looking for.
If I use
I can find the email.
Some part of the code:
It only happens on the server. It will do fine on my computer.
Any idea why?
Also when I loop through the mails on the inbox, it will only loops half way.
Example: I found 5 unread email. It will read the first 3.
This happens only when I mark the email as read. Any idea how to loop the proper way?
Thanks.
When I tried it on the server, I can find all of the item that fits with the filter., say, I found 3 emails out of 20000 emails.
When I use
Code:
oUnreadMailItem = (MailItem)oItems.Find(sFilterInbox);
If I use
Code:
oUnreadMailItem = (MailItem)oItems[1];
Some part of the code:
Code:
String sTotalEmail = oInboxFolder.Items.Count.ToString();
String sFilterInbox = "@SQL=\"urn:schemas:httpmail:read\"=0 and \"urn:schemas:httpmail:subject\" like '%" + sSubjectEmailPattern + "%' and \"urn:schemas:httpmail:fromemail\" like '%" + sEmailSenderPattern + "%' ";
putMessage("Filter: " + sFilterInbox);
oInboxFolderItems = oInboxFolder.Items.Restrict(sFilterInbox);
oInboxFolderItems.Sort("ReceivedTime", true);
if(oInboxFolderItems.Count > 0)
dtLastReceivedTime = ((MailItem)oInboxFolderItems[1]).ReceivedTime;
String sCount = oInboxFolderItems.Count.ToString();
putMessage("Found " + sCount + " " + CheckReFaxOn.ToString() + " message(s) out of " + sTotalEmail + " email(s).");
Items oItems = oInboxFolder.Items.Restrict(sFilterInbox);
iTotalEmailNeedToBeCheck = oItems.Count;
oUnreadMailItem = (MailItem)oItems.Find(sFilterInbox);
MailItem oMailTest = null;
while(oUnreadMailItem != null) // this works on my computer but it won't work (always null) on server
{
// do something
}
It only happens on the server. It will do fine on my computer.
Any idea why?
Also when I loop through the mails on the inbox, it will only loops half way.
Code:
sFilterInbox = "[UnRead]=true";
foreach(MailItem Item in oInboxFolder.Items.Restrict(sFilterInbox)) /// read unread only
{
//if(something)
// mark as read
//else
// continue
}
This happens only when I mark the email as read. Any idea how to loop the proper way?
Thanks.