Hello I have some problem with reading message in some email (inbox) I see this message in inbox (Outlook client), but it is not found by method FindItem. It happens after some experiments with this message, but what I do not understand. Other messages was founded good. There is a simple code on C# (search all messages in inbox) via EWS proxy classes (Exchange 2007)
Why this message is not visible for FindItem and visible for me?
thank you and sorry for poor english!
Code:
private static bool getReceiveMessages(string _email, out ItemType[] messages)
{
//for errorLog
string msgPrefix = "?ethod GetReceiveMessages(" + _email + ")\r\n";
FindItemType request = new FindItemType();
request.ItemShape = new ItemResponseShapeType();
request.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties;
DistinguishedFolderIdType folder = new DistinguishedFolderIdType();
folder.Id = DistinguishedFolderIdNameType.inbox;
folder.Mailbox = new EmailAddressType();
folder.Mailbox.EmailAddress = _email;
request.ParentFolderIds = new BaseFolderIdType[] { folder };
request.Traversal = ItemQueryTraversalType.Shallow;
//
try
{
FindItemResponseType response =binding.FindItem(request);
FindItemResponseMessageType responseMessage =
response.ResponseMessages.Items[0] as FindItemResponseMessageType;
if (responseMessage.ResponseClass != ResponseClassType.Success)
{
LogWriter.Write(msgPrefix + responseMessage.MessageText);
messages = null;
return false;
}
// get messages
messages = (responseMessage.RootFolder.Item as ArrayOfRealItemsType).Items;
}
catch (Exception ex)
{
//write in log
//LogWriter.Write(msgPrefix + ex.Message);
messages = null;
return false;
}
return true;
}
thank you and sorry for poor english!