Null exception when trying to get user availability information (c#, ews)

2020-08-07T19:25:13.747+00:00

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(); }
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
38,709 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. KyleXu-MSFT 26,256 Reputation points
    2020-08-10T07:39:41.487+00:00

    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.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.