linkedin / pyexchange

Python wrapper for Microsoft Exchange
Apache License 2.0
153 stars 98 forks source link

Wrong exchange datetime format #29

Closed h3 closed 9 years ago

h3 commented 9 years ago

With the latest code I now get an invalid datatype error when calling list_events.

My code runs fine with 0.5, but when I try with HEAD I get this:

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
    <s:Fault>
        <faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorSchemaValidation</faultcode>
        <faultstring xml:lang="en-US">The request failed schema validation: The 'EndDate' attribute is invalid - The value '2014-11-30' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:dateTime' - The string '2014-11-30' is not a valid XsdDateTime value.</faultstring>
        <detail>
            <e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorSchemaValidation</e:ResponseCode>
            <e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">The request failed schema validation.</e:Message>
            <t:MessageXml xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
            <t:LineNumber>1</t:LineNumber>
            <t:LinePosition>355</t:LinePosition>
            <t:Violation>The 'EndDate' attribute is invalid - The value '2014-11-30' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:dateTime' - The string '2014-11-30' is not a valid XsdDateTime value.</t:Violation>
        </t:MessageXml>
    </detail>
</s:Fault>
</s:Body>
</s:Envelope>

Changing EXCHANGE_DATE_FORMAT for EXCHANGE_DATETIME_FORMAT in line 120 & 121 of soap_request.py fixes the issue for me.. but I'm not sure it's the right way to fix this.

Edit: fixed wrong line numbers

got-root commented 9 years ago

Which branch are you on? This was fixed in pull request #24.

h3 commented 9 years ago

That's very strange .. I forked the project 2 days ago, worked on a branch to add a feature.

Then yesterday I merged linkedin/pyexchange/master back to my fork to get the latest changes (which was only your fix if I recall). Then I merged my master to my branch, at this point both were affected by this bug.

I guess I'll have to dig to find what happened, sorry for the false report.