Q&A Exchange doesn't supported for Exchange development so far. You could post your question in stackoverflow forum or open a ticket to Microsoft.
Null exception when trying to get user availability information (c#, ews)
Алексей Чегодайкин
1
Reputation point
Hello. I am trying getting user availability from exchange server 2016 by ews. My code is working on test server, but when migrating to production server, Null reference exception appears (first line). Server configurations are different. It is problematic to find out the configuration of an industrial server in my conditions. What could be the problem with this? Is it possible that there is no such user at all or no access? I receive data through a * shared "account. If someone can tell you which way to look for a solution, I would be grateful.
Part of code:
GetUserAvailabilityResults uars = service.GetUserAvailability(new AttendeeInfo[] { new AttendeeInfo(mails[i], MeetingAttendeeType.Required, true) }, new TimeWindow(DateTime.Now, DateTime.Now.AddDays(1)), AvailabilityData.FreeBusy);
if ((uars is null) |(uars.AttendeesAvailability[0] is null) | (uars.AttendeesAvailability[0].WorkingHours is null) | (uars.AttendeesAvailability[0].WorkingHours.TimeZone is null)) { account_time_zone = "-13"; }
else { account_time_zone = uars.AttendeesAvailability[0].WorkingHours.TimeZone.BaseUtcOffset.Hours.ToString(); }