Reputation: 4552
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.
Upvotes: 0
Views: 324
Reputation: 22032
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://learn.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
Upvotes: 1