exchangewebservicesmanaged-ews

Retrieve Outlook Calendar Working Hours


I'm using Exchanged Web Services and would like to retrieve a users "Work Hours". Work hours is a setting on the Calendar and helps with free/busy calculations, but I'd like to get or calculate the actual values.

I have full access to the calendar. If I can use the EWS Managed API that would be my preference. I've searched online, and looked at the GetUserAvailability operation, but I haven't been able to find a method that will give me this data.


Solution

  • If your using Exchange 2010 or later you can get the working hours configuration (documented in http://msdn.microsoft.com/en-us/library/ee202895(v=exchg.80).aspx ) from the IPM.Configuration.WorkHours UserConfiguration FAI object (Folder Associated Items) using the GetUserConfiguration operation in EWS http://msdn.microsoft.com/en-us/library/office/dd899439(v=exchg.150).aspx . eg

    UserConfiguration usrConfig = UserConfiguration.Bind(service, "WorkHours", WellKnownFolderName.Calendar, UserConfigurationProperties.All);
    XmlDocument xmlDoc = new XmlDocument();
    xmlDoc.Load(new MemoryStream(usrConfig.XmlData));
    XmlNodeList nlList =  xmlDoc.GetElementsByTagName("WorkHoursVersion1");
    Console.WriteLine(nlList.Item(0).InnerXml);