ews-managed-api
ews-managed-api copied to clipboard
How to Get Emails from Exchange Server using Asp .net Core
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
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.
I have used this fork with success
https://github.com/sherlock1982/ews-managed-api
You need to fix several issues so that it not only compiles, but also works on Linux. I've gotten it to work:
- ActiveDirectory (you need to replace it for that it works correctly)
- TimeZoneNames - they are different on Windows and Linux - the get written in the XML-webservice-exchange-file, so you get a HTTP 500.
- NTLM with double header (negotiate, ntlm) doesn't work on Linux - bug in .NET Framework/CURL.
- 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.
Thanks all
You need to fix several issues so that it not only compiles, but also works on Linux. I've gotten it to work:
- ActiveDirectory (you need to replace it for that it works correctly)
- TimeZoneNames - they are different on Windows and Linux - the get written in the XML-webservice-exchange-file, so you get a HTTP 500.
- NTLM with double header (negotiate, ntlm) doesn't work on Linux - bug in .NET Framework/CURL.
- 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?
- Issue has been fixed with new version of System.DirectoryServices
- Read the timezone file and translate between Linux and Windows TimeZones
- 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