none
Outlook Work Hours from EWS is incorrect on MAC only RRS feed

  • Question

  • Hello,

    We have an application on the Mac that retrieves the user's work hours.   (See code below) 

    If I change the work hours in Outlook for Mac version 15.x, when we launch our application, the downloaded information from EWS is not correct.   For example my work hours are from 9am - 4:30pm.  I change the work hours to 10am - 5:30pm and this change is not being reflected in our app.   The same piece of code below works on a windows machine with Outlook 2010.    This is written in javascript so both windows and mac share the same exact code.     Can anyone tell me what is going wrong?   This seems like an EWS problem.   

      getCalenderConfiguration: function (observer) {
            var parser,decodedXml,xdoc,err,whNode,bias,parsedWorkHours={};
            var workHours = {startTime:'00:00:00',endTime:'00:00:00',stdBias:0,dstBias:0,workDays:''};
            var dfd = can.Deferred();
    
            function GetCalenderConfigurationSuccess(request, xml) {
                console.info('getCalenderConfigurationSuccess:',request.data);
                this._workHoursItemId = request.data.ItemId;
                decodedXml = window.atob(request.data.XmlData);
                console.debug('getCalenderConfigurationSuccess decoded xmlData:',decodedXml);
                parser = new DOMParser();
                xdoc = parser.parseFromString(decodedXml, 'text/xml');
                if (xdoc) {
                    if (xdoc.parseError && xdoc.parseError.errorCode !== 0) {
                        err = 'xml parse error: ' + xdoc.parseError.reason + ',line ' + xdoc.parseError.line + ',position ' + xdoc.parseError.linepos;
                        console.error('GetCalenderConfigurationSuccess Error:'+err);
                    }
                    else if (xdoc.documentElement && xdoc.documentElement.childNodes[0].nodeName === 'parsererror') {
                        err = xdoc.documentElement.childNodes[0].textContent;
                        console.error('GetCalenderConfigurationSuccess Error:'+err);
                    } else if (!xdoc.documentElement) {
                        console.error('GetCalenderConfigurationSuccess xml parse error');
                    } else {
                        whNode = xdoc.getElementsByTagName('WorkHoursVersion1');
                        if (whNode[0]) {
                            parsedWorkHours = this._parseXmlWithAttribute(whNode[0]);
                            // we need all elements to create a valid schedule
                            if (parsedWorkHours.WorkDays && parsedWorkHours.TimeSlot && parsedWorkHours.TimeSlot.Start &&
                                    parsedWorkHours.TimeSlot.End && parsedWorkHours.TimeZone && 
                                    parsedWorkHours.TimeZone.Bias && parsedWorkHours.TimeZone.Standard && 
                                    parsedWorkHours.TimeZone.DaylightSavings) {
                                workHours.startTime = parsedWorkHours.TimeSlot.Start['#text'];
                                workHours.endTime = parsedWorkHours.TimeSlot.End['#text'];
                                bias = parseInt(parsedWorkHours.TimeZone.Bias['#text'],10);
                                workHours.stdBias = parseInt(parsedWorkHours.TimeZone.Standard.Bias['#text'],10) + bias;
                                workHours.dstBias = parseInt(parsedWorkHours.TimeZone.DaylightSavings.Bias['#text'],10) + bias;
                                workHours.workDays = parsedWorkHours.WorkDays['#text'].toUpperCase();
                                if (workHours.workDays === 'WEEKDAYS') {
                                    workHours.workDays = 'MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY';
                                } else if (workHours.workDays === 'WEEKENDDAYS') {
                                    workHours.workDays = 'SATURDAY SUNDAY';
                                }
                            }
    
                        }
                    }
                }
                dfd.resolve(workHours);
            }

    Wednesday, June 15, 2016 12:10 AM

All replies

  • It sounds more a like a problem with Outlook mac you can try to troubleshoot it further by looking at the XML you get back when you make the request (eg this should include the timezone and regional setting etc). which you should post rather then your code.

    I would suggest you try to do a network capture when you make the Workhour changes in the Mac client, you should be able to see the EWS request that is being submitted in that instance and you can look at the effect this is having. But you need to compare all 3 of these results which should point to what is happening.

    Cheers
    Glen

    Thursday, June 16, 2016 2:12 AM
  • Here is the XML file being returned.   This definitely is a bug in Outlook for Mac.   

    My work hours as seen on a windows machine from Outlook 2010 is from 9a - 4:30pm.   This is seen below in the XML when when our application downloads from EWS on the Mac.   However in my Outlook for Mac my work hours are configured to 9:30am - 7pm.    I noticed that when I change my work hours in 2010 then our application reflects the change made on my windows machine.   My Outlook for Mac calendar still shows my work hours as 9:30a - 7pm.  

    <?xml version="1.0"?> <Root xmlns="WorkingHours.xsd"> <WorkHoursVersion1> <TimeZone> <Bias>480</Bias> <Standard> <Bias>0</Bias> <ChangeDate> <Time>02:00:00</Time> <Date>0000/11/01</Date> <DayOfWeek>0</DayOfWeek> </ChangeDate> </Standard> <DaylightSavings> <Bias>-60</Bias> <ChangeDate> <Time>02:00:00</Time> <Date>0000/03/02</Date> <DayOfWeek>0</DayOfWeek> </ChangeDate> </DaylightSavings> <Name>Pacific Standard Time</Name> </TimeZone> <TimeSlot> <Start>09:00:00</Start> <End>16:30:00</End> </TimeSlot> <WorkDays>Monday Tuesday Wednesday Thursday Friday</WorkDays> </WorkHoursVersion1> </Root>


    Thursday, June 16, 2016 4:51 PM