Microsoft Exchange "findItems" not fetching new emails

Sir.Murky 0 Reputation points
2024-11-13T13:45:03.95+00:00

Hello,

There is some sort of a problem with an email, but I can't log error why.

I am using ExchangeVersion.Exchange2015

//Normally I am trying to get 100 emails per findItems, but if any email is "bad" I don't get any of emails...
var itemView = new ItemView(1, 0, OffsetBasePoint.Beginning);

itemView.OrderBy.Add(ItemSchema.DateTimeReceived, SortDirection.Descending);

FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, filter, itemView).Result;

And I get error:

Name cannot begin with the '<' character, hexadecimal value 0x3C. Line 1, position 23012.

I have enabled tracer:

service.TraceEnabled = true;

service.TraceFlags = TraceFlags.All;

service.TraceListener = new EwsReaderTraceListener();

public void Trace(string traceType, string traceMessage)

{

 _log.Information("");

 _log.Information("EWS_TRACING_BEGINS");

 _log.Information(traceType);

 _log.Information(traceMessage);

 _log.Information("EWS_TRACING_ENDS");

 _log.Information("");
}

Debugger stops two times, one is with response of findItems being 200 and the other traceMessage says "System.IO.MemoryStream" and that's all.

If I call service.FindItems(WellKnownFolderName.Inbox, filter, itemView) it works

If I call service.FindItems(WellKnownFolderName.Inbox, filter, itemView) .Result it crashes

If I change sorting from "Descending" to "Ascending" then it works, which indicates that there is a problem with the newest email, but how do I catch what is the error in my tracer

Thank you all in advance :)

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,970 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,099 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,703 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.