linkedin / pyexchange

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

Creating an event with a different "status" #55

Open cmannfolk opened 8 years ago

cmannfolk commented 8 years ago

I am trying to create an event that has a "status" of "Free". As far as I can tell the functionality is there... Exchange2010CalendarEvent:

def _parse_event_properties(self, response): property_map = { u'subject': { u'xpath': u'//m:Items/t:CalendarItem/t:Subject', }, u'location': { u'xpath': u'//m:Items/t:CalendarItem/t:Location', }, u'availability': { u'xpath': u'//m:Items/t:CalendarItem/t:LegacyFreeBusyStatus', },

I am unable to change this value to anything (my version of Outlook defaults to "Busy"). If list my events, with the list_events() function I am able to get the status/availability (free, busy, tentative,etc.) by using status = event.availability when looping through my list of events. Is this an issue with Microsoft? Or can this be fixed? Thanks for your help.

catermelon commented 8 years ago

Hi @cmannfolk, you probably will have to add it to the pyexchange code. I don't officially support this project anymore (I've moved on from LI and I don't have a exchange server to test on) but I can try and point you in the right direction.

The basics are, you'll need to edit the calendar class to understand about event status, so you can access it and get/set it. Then you'll need to edit the XML it sends to Exchange to create the event, as well as edit the code that parses the response.

These are the main classes you'll need to look at:

https://github.com/linkedin/pyexchange/blob/master/pyexchange/exchange2010/__init__.py https://github.com/linkedin/pyexchange/blob/master/pyexchange/base/calendar.py

And the XML to create the event is here:

https://github.com/linkedin/pyexchange/blob/master/pyexchange/exchange2010/soap_request.py#L280

Please also write some tests around it and promise in blood you've tested on a real exchange server. :)