简体   繁体   中英

How to get Exchange server current datetime using ExchanceService api?

I stumbled with a legacy application in C# that creates an item, saves it, fetches the creation date and deletes it right after, using ExchangeService api. All this to simply get the current server time.

There's gotta be a better way of doing this, but I went through all the online docs and did a few searches about it and couldn't find anything.

So, simple question: how to fetch Exchange server current datetime using C# ?

Thanks in advance.

Where is the application running ? eg if its running on the server or any domain connected machine then querying the time from the Exchange server should be redundant. Eg Windows servers within a Domain should sync there time via Windows time service https://docs.microsoft.com/en-us/windows-server/networking/windows-time-service/how-the-windows-time-service-works . And usually you would setup a DC to sync the time from NTP so every machine should have same time (in theory).

The Exchange API's don't have an time methods but any request to an Exchange server should return the Date Header in the Response headers as it a mandatory property in Http https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.18

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM