exchange FindFolders: specific value has invalid HTTP Header Characters

ReMED Services Orders 0 Reputation points
2024-01-10T16:07:22.94+00:00

Hi,  I recently started hitting a bug, and any suggestions on how to work around this would be greatly appreciated.

There were no changes to the code in the past 12 months+, and suddenly the application is breaking at this line:

 

var ewsClient = new ExchangeService();
ewsClient.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
ewsClient.Credentials = new OAuthCredentials(authResult.AccessToken);
ewsClient.ImpersonatedUserId =
new ImpersonatedUserId(ConnectingIdType.SmtpAddress, mailbox);

//Include x-anchormailbox header
ewsClient.HttpHeaders.Add("X-AnchorMailbox", mailbox);

 

var folders = ewsClient.FindFolders(WellKnownFolderName.Inbox, new FolderView(10));

 

This last line throws an error:

Specified value has invalid HTTP Header characters.
Parameter name: name

Thank you!

Microsoft Exchange Online
Exchange Server Development
Exchange Server Development
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Development: The process of researching, productizing, and refining new or existing technologies.
525 questions
Microsoft Exchange
Microsoft Exchange
Microsoft messaging and collaboration software.
442 questions
{count} votes