ews-managed-api icon indicating copy to clipboard operation
ews-managed-api copied to clipboard

How to Get Emails from Exchange Server using Asp .net Core

Open rakeshagarwalARRK opened this issue 7 years ago • 6 comments

Hi,

I need help on How to Get Emails from Exchange Server using Asp .net Core, I can't find any library of nuget package that can do it.

If possible I also need to Get emails as .pst file,

Please help, thanks

rakeshagarwalARRK avatar Feb 21 '18 10:02 rakeshagarwalARRK

Are you only needing access to Office365 (Exchange Online), or do you also need to access legacy on-prem servers (Exchange 2016 and below)? If the former you should use the graph API https://developer.microsoft.com/en-us/graph/docs/concepts/overview

I havent looked at the code, but the below sounds promising as an example: https://github.com/microsoftgraph/aspnetcore-connect-sample

If the latter, then you will likely need to use EWS.

davster avatar Feb 21 '18 19:02 davster

I have used this fork with success

https://github.com/sherlock1982/ews-managed-api

mikes-gh avatar Mar 19 '18 15:03 mikes-gh

You need to fix several issues so that it not only compiles, but also works on Linux. I've gotten it to work:

  1. ActiveDirectory (you need to replace it for that it works correctly)
  2. TimeZoneNames - they are different on Windows and Linux - the get written in the XML-webservice-exchange-file, so you get a HTTP 500.
  3. NTLM with double header (negotiate, ntlm) doesn't work on Linux - bug in .NET Framework/CURL.
  4. Some other minor fixes, that it compiles.

I ported it (everything short of issue 1 - therefore must manually set the service-url). I have it working on Linux, here, with .NET Core 2.0.

ststeiger avatar May 20 '18 17:05 ststeiger

Thanks all

rakeshagarwalARRK avatar Jul 17 '18 04:07 rakeshagarwalARRK

You need to fix several issues so that it not only compiles, but also works on Linux. I've gotten it to work:

  1. ActiveDirectory (you need to replace it for that it works correctly)
  2. TimeZoneNames - they are different on Windows and Linux - the get written in the XML-webservice-exchange-file, so you get a HTTP 500.
  3. NTLM with double header (negotiate, ntlm) doesn't work on Linux - bug in .NET Framework/CURL.
  4. Some other minor fixes, that it compiles.

~I ported it (everything short of issue 1 - therefore must manually set the service-url). ~ I have it working on Linux, here, with .NET Core 2.0.

How to solve all these problems? Do you have any working solution? I am running simple code on MacOS and gives Unauthorized 401 problem. Did you manage to solve this problem completely?

rashad-farajullayev avatar May 05 '20 02:05 rashad-farajullayev

  1. Issue has been fixed with new version of System.DirectoryServices
  2. Read the timezone file and translate between Linux and Windows TimeZones
  3. I switched a negotiate-header removing Proxy-Server (Titanium.Web.Proxy) in between ews-managed and the internet

Number 3 should be unnecessary if you update to .NET Core 3.0+. That is, assuming MS fixed that bug.

See https://github.com/OfficeDevUnofficial/ews-managed-api

ststeiger avatar May 06 '20 10:05 ststeiger