RobertoOSantos
RobertoOSantos

Reputation: 142

How to use EWS API with Console App Net Core

I'm trying to use this Net Standard package https://github.com/sherlock1982/ews-managed-api to connect to Exchange in a Console App with .Net Core.

The Autodiscovery apparently doesn't find the server and I can't get an Exchange Response after Send() email.

Same code works flawlessly in ASP.Net Core Web Api.

I guess it's some package reference stuff but I can't figure it out.

Upvotes: 0

Views: 10803

Answers (3)

Eric Pitz
Eric Pitz

Reputation: 364

For those finding this question while searching how to connect to an onpremise Exchange installation from .net core:

I found that the Nuget Package mentioned by op had various bugs. Thats why I searched an alternative. In the end I found that the safest and easiest was to download the entire repository ews-managed-api and ported it myself to .net standard using the visual studio "upgrade assistant"-extension.

I had it working within less than an hour. No unknown reference to unthrusted dll, no unexpected bugs, ...

To connect to Exchange within Office365, Microsoft recommends using Microsoft Graph which I beleave is available for .net core.

Upvotes: 0

kuns200
kuns200

Reputation: 1

You should use EWS Subscription mechanism if you want to handle more than ~20 mailboxes to be monitored.

Upvotes: -1

RobertoOSantos
RobertoOSantos

Reputation: 142

I've figured out.

The .Net Standard version of EWS API is totally async, which means I must handle it properly.

As I'm not concerned about parallelism, I've used Wait method to sync wait for it.

https://learn.microsoft.com/pt-br/dotnet/api/system.threading.tasks.task.wait?view=netcore-2.1

Upvotes: 0

Related Questions