GithubHelp home page GithubHelp logo

pyexchange's Introduction

PyExchange

Build Status Coverage Status

PyExchange is a library for Microsoft Exchange.

It's incomplete at the moment - it only handles calendar events. We've open sourced it because we found it useful and hope others will, too.

If you're interested, please see the CONTRIBUTING notes in the repo for hints on where to get started.

Documentation

Go to https://pyexchange.readthedocs.org for the most recent, up-to-date version of documentation.

Installation

PyExchange supports Python 2.6 and 2.7, and as of 0.6, is Python 3 compatible. Non CPython implementations may work but are not tested.

We support Exchange Server version 2010. Others will likely work but are not tested.

To install, use pip:

pip install pyexchange

About

Once upon a time there was a beautiful princess, who wanted to connect her web application to the royal Microsoft Exchange server.

The princess first tried all manner of SOAP libraries, but found them broken, or slow, or not unicode compliant, or plain just didn't work with Exchange.

"This totally bites," said the princess. "I need like four commands and I don't want to make my own SOAP library."

She then discovered Microsoft had excellent documentation on its Exchange services with full XML samples.

"Bitchin," said the princess, who had watched too many 80s movies recently. "I'll just write XML instead."

So she did, and it worked, and there was much feasting and celebration, followed by a royal battle with accounting over what constituted reasonable mead expenses.

And everybody lived happily ever after.

THE END

pyexchange's People

Contributors

brazzi64 avatar got-root avatar lebenhl avatar lwoydziak avatar nicklasb avatar nud avatar tbolender avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyexchange's Issues

ImportError: cannot import name ExchangeNTLMAuthConnection

Hi,

I installed using the command pip install pyexchange. I'm trying out a basic create event program using the code in the documentation. However I run into the error "ImportError: cannot import name ExchangeNTLMAuthConnection" when trying to import it. I tried reinstalling the package but that didn't help either.

Any help would be greatly appreciated.

Thanks.

TypeError: 'Exchange2010CalendarEventList' object is not iterable

I can retrieve all my events from calendar (like this [1]) but objet is not iterable :

events = cal.list_events(start, end, details=True)
print("Events: %s" % events)
for event in events:
     print "{start} {stop} - {subject}".format(
        start=event.start,
        stop=event.end,
        subject=event.subject
    )

I've got this error :

TypeError: 'Exchange2010CalendarEventList' object is not iterable

I'm using v0.6

[1] : https://pyexchange.readthedocs.org/en/latest/#listing-events

Review and add doc around timezone handling

It sounds like the docs aren't clear around us returning UTC datetimes rather than localtime (see issue #35) so we should review and make it less confusing.

Need to include the reasoning on why we return UTC and not localtimes (see SO question linked in #35 and use that summary)

get other account's public calendar

possible to get another account's public calendar ?
as the function in viewpoint : https://github.com/WinRb/Viewpoint

cli = Viewpoint::EWSClient.new(endpoint, user, pass)
start_time = DateTime.parse("2015-06-24").iso8601
end_time = DateTime.parse("2015-06-26").iso8601
user_free_busy = cli.get_user_availability(['[email protected]'],
start_time: start_time,
end_time: end_time,
requested_view: :free_busy)
busy_times = user_free_busy.calendar_event_array

Issue with parsing Exchange server details

Hi,

I am using pyexchange 0.6(latest as of now).
I am running my python script in Linux.
I am trying to connect to Outlook Exchange Server using this module.

I am getting an error which says,

python3.5/site-packages/pyexchange-0.6-py3.5.egg/pyexchange/base/soap.py", line 42, in _parse
raise FailedExchangeException(u"Unable to parse response from Exchange - check your login information. Error: %s" % err)
pyexchange.exceptions.FailedExchangeException: Unable to parse response from Exchange - check your login information. Error: Double hyphen within comment: <!--[if lt IE 9]>
<link rel="stylesheet" href="inc, line 16, column 87 (, line 16)

Can someone please help?

Please Note:
The exact same script works fine in my windows environment without any errors.
I am using the same pyexchange and lxml modules (versions) in both the environments.

Thanks,
Phani.

How to get events from shared calendar?

I have been able to list events from my own personal calendar, but I'm struggling to understand how to access a shared calendar. I know the name of the shared calendar, but it seems like I need to determine the EWS ID of that calendar. Any advice on how to do that? I have OutlookSpy installed, but even with that it's not really clear.

Thanks,
Adam

How To connect to a room calendar

i really dont get one of our room calendar, can someone tell me how to list the events of a room?

i always only become events out of my calendar.

thank you so much.

Martin

no content with SSL: CERTIFICATE_VERIFY_FAILED error

i try to list events.
If i've got an error of type CERTIFICATE_VERIFY_FAILED, the library failed :

File "/venv/lib/python2.7/site-packages/pyexchange/connection.py", line 67, in send
    log.debug(err.response.content)
AttributeError: 'NoneType' object has no attribute 'content'

It works with : log.debug(err)

pyexchange.exceptions.FailedExchangeException: Unable to connect to Exchange: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)

Errors with Calendar Events having Attendees without an E-Mail Address

Hi together,
for a fancy calendar being displayed on our institute's TV screens, we have decided using an Exchange calendar (easy integration with our other calendars and stuff) & reading needed data with PyExchange for creating some kind of displaying image. I very appreciate this easy-to-use library!

However, as soon an event gets parsed that has an attendee without an email address, a TypeError is raised. Taking a closer look into the sources, you explicitly disallow mail addresses with a None value. Is there a special reason for this?
For us, this particularly does not fit our needs; there is no guarantee having 'valid' entries. I handled this by just setting an empty string in case the attendee_properties do not contain the key 'email' just before parsing the dictionary [init py, before line 504]. This works, but is kind of a quick & dirty hack.

Anyways, I just wanted to let you know about this issue.
Finally, here is the trace:

Traceback (most recent call last):
  File "a.py", line 79, in <module>
    details=True
  File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 95, in list_events
    return Exchange2010CalendarEventList(service=self.service, start=start, end=end, details=details)
  File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 124, in __init__
    self.load_all_details()
  File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 170, in load_all_details
    self._parse_response_for_all_events(response_xml)
  File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 139, in _parse_response_for_all_events
    self._add_event(xml=soap_request.M.Items(deepcopy(item)))
  File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 147, in _add_event
    event = Exchange2010CalendarEvent(service=self.service, xml=xml)
  File "/usr/local/lib/python2.7/dist-packages/pyexchange/base/calendar.py", line 90, in __init__
    self._init_from_xml(xml)
  File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 194, in _init_from_xml
    properties = self._parse_response_for_get_event(xml)
  File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 504, in _parse_response_for_get_event
    result[u'_attendees'] = self._build_resource_dictionary([ExchangeEventResponse(**attendee) for attendee in attendee_properties])
TypeError: __new__() takes exactly 6 arguments (5 given)

Wrong exchange datetime format

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

Creating Contacts in Outlook [Started development]

Hi guys,

Since this library had some amazing implementations and did a lot of the things I needed I decided to expand it and put some effort in to it.
I'm not used to anything related Exchange / SOAP but tried to manage with what was already here.
I've forked this repository and added as much as I could for now. You can see my added code here: master...Yenthe666:master

I've now ran stuck on the following error:

pyexchange.exceptions.FailedExchangeException: Unable to connect to Exchange: 500 Server Error: Internal Server Error

Which comes from exceptions.py in the function FailedExchangeException:

class FailedExchangeException(Exception):
  """Raised when the Microsoft Exchange Server returns an error via SOAP for a request."""
  pass

Example code to create a new contact:

from pyexchange import Exchange2010Service, ExchangeNTLMAuthConnection

URL = u'https://mail.yourdomain.com/EWS/Exchange.asmx'
USERNAME = u'DOMAIN\\yenthe'
PASSWORD = u"mypassword"
from datetime import datetime
from pytz import timezone

# Set up the connection to Exchange
connection = ExchangeNTLMAuthConnection(url=URL,
                                        username=USERNAME,
                                        password=PASSWORD)

service = Exchange2010Service(connection)


# You can set event properties when you instantiate the event...
contact = service.contact().new_contact(
  name=u"Yenthe",
  company_name = u"Google",
)

# Connect to Exchange and create the event
contact.create()

Could anybody help me and finish this implementation? I do not know how to fix this issue but I think this is a good start.

not all requests exception have a "response" object

[...] File "/home/mdupuy/dev/pyexchange/pyexchange/base/soap.py", line 65, in _send_soap_request response = self.connection.send(body, headers, retries, timeout) File "/home/mdupuy/dev/pyexchange/pyexchange/connection.py", line 68, in send log.debug(err.response.content) AttributeError: 'NoneType' object has no attribute 'content'

For all error that occur before server response, like connectivity error and some other else, RequestException does not have a response attribute. Maybe use something else like requests.Exception.message, which always contains the reason of the error, whatever is the faulty layer.

Messages support and Python 3

Hi,
Interesting project!

I am wondering if there are any plans to add support for monitoring mail boxes and retrieving messages. If not, would you think that including that into pyexchange would be a significant effort, and how would you want it to be included architecturally, as it is about long polling and so forth?

More specifically, I am considering implementing Streaming Notifications for monitoring.
http://msdn.microsoft.com/en-us/library/office/hh312849%28v=exchg.140%29.aspx

E-Mail Support?

Our institution disables SMTP functionality on our e-mail accounts, forcing us to use their web client or some other native Exchange client (mobile or otherwise). We want our web apps to send out automated e-mails through our institutions exchange system as local e-mails are secure.

So, is there any plan to add E-mail/Inbox functionality to pyexchange? Also, how much effort do you estimate is required if I were to want to extend your code to do this?

NTLM Authentication Error

We've been using PyExchange to read appointments in an Outlook calendar in work, and recently after a seemingly unrelated code release have been getting "FailedExchangeException: Unable to parse response from Exchange - check your login information. Error: None". I've narrowed the error down to when the ExchangeNTLMAuthConnection sends "request = urllib2.Request(self.url, data=body, headers=headers)" to our company's Exchange URL, it's getting an empty string from "urllib2.urlopen(request).read(). I've tried reading another URL with this method and it returns data, I can't figure out why it's getting an empty string here. The login details haven't been changed or altered in the db where they're stored. Can anyone help?

All day event

Hello!
How to create all day event? I try this code but no luck:
event.start = timezone("US/Pacific").localize(datetime.datetime.today().replace(hour=0,minute=0,second=0)) event.end = timezone("US/Pacific").localize(datetime.datetime.today().replace(hour=23,minute=59,second=59))

line 67 in connection.py unhandled exception

The try-catch block has a unhandled exception in the catch statement in line 67. This happens when we pass a url that is of type 'https' but it does not have a valid certificate certified by a CA.

This throws the following exception:
>>> c.list_events(start=start_xchange, end=end_exchange, details=True) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 95, in list_events return Exchange2010CalendarEventList(service=self.service, start=start, end=end, details=details) File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 113, in __init__ response_xml = self.service.send(body) File "/usr/local/lib/python2.7/dist-packages/pyexchange/base/soap.py", line 34, in send response = self._send_soap_request(request_xml, headers=headers, retries=retries, timeout=timeout, encoding=encoding) File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 44, in _send_soap_request return super(Exchange2010Service, self)._send_soap_request(body, headers=headers, retries=retries, timeout=timeout, encoding=encoding) File "/usr/local/lib/python2.7/dist-packages/pyexchange/base/soap.py", line 65, in _send_soap_request response = self.connection.send(body, headers, retries, timeout) File "/usr/local/lib/python2.7/dist-packages/pyexchange/connection.py", line 67, in send log.debug(err.response.content) AttributeError: 'NoneType' object has no attribute 'content'

This is thrown because of _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in the requests (line 64) has verify=True set by default. Turning that flag off does everything normally.

Get all calendar IDs

What I have:

folders = service.folder().find_folder(parent_id='calendar')
for folder in folders:
    print folder.display_name, folder.id

returns:
Local-calendar-1 XYZXYZ...=
Local-calendar-2 YZAYZA...=

What I want:
Local-calendar-1 XYZXYZ...=
Local-calendar-2 YZAYZA...=
Shared-calendar ZABZAB...=

With OutlookSpy I get an EntryID in hex, but its shorter than the pyexchange IDs (base64). I converted via:

'<EntryID>'.decode('hex').encode('base64')

Getting ErrorRecurrenceHasNoOccurrence when reading calendar events

I'm using pyexchange to read calendar events and save them to a web application, but I get this error on occasion when running the sync code, and I'm trying to figure out exactly what triggers it, and if it's going to stop events being synced to the web app, and how to handle it. Any ideas what particular situation triggers it?

Library maintenance going forward?

There are a few pull requests with additional functionality (in particular #56 has some excellent RoomList additions that I've based my fork off of and have additional contributions for) but it appears the last update to this repository is two years ago.

Is there any plan to hand this or the entry in PyPi over to another entity?

Exception with recent upgrade to requests

Getting an exception when upgrading from requests==2.6.0 to 2.6.1:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/LabStaff/alejandror/Envs/cs_web/lib/python2.7/site-packages/pyexchange/exchange2010/__init__.py", line 769, in find_folder
    response_xml = self.service.send(body)
  File "/home/LabStaff/alejandror/Envs/cs_web/lib/python2.7/site-packages/pyexchange/base/soap.py", line 35, in send
    return self._parse(response, encoding=encoding)
  File "/home/LabStaff/alejandror/Envs/cs_web/lib/python2.7/site-packages/pyexchange/base/soap.py", line 42, in _parse
    raise FailedExchangeException(u"Unable to parse response from Exchange - check your login information. Error: %s" % err)
FailedExchangeException: Unable to parse response from Exchange - check your login information. Error: Start tag expected, '<' not found, line 1, column 1

This happens with any request to the server. Ran the py.test and everything came out good, might not have a test around this.

How can I know what's the problem about connections

While I try to create an event at start using pyexchange:

AttributeError Traceback (most recent call last)
in ()
31
32 # Connect to Exchange and create the event
---> 33 event.create()

/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/init.pyc in create(self)
260 body = soap_request.new_event(self)
261
--> 262 response_xml = self.service.send(body)
263 self._id, self._change_key = self._parse_id_and_change_key_from_response(response_xml)
264

/usr/local/lib/python2.7/dist-packages/pyexchange/base/soap.pyc in send(self, xml, headers, retries, timeout, encoding)
32 request_xml = self._wrap_soap_xml_request(xml)
33 log.info(etree.tostring(request_xml, encoding=encoding, pretty_print=True))
---> 34 response = self._send_soap_request(request_xml, headers=headers, retries=retries, timeout=timeout, encoding=encoding)
35 return self._parse(response, encoding=encoding)
36

/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/init.pyc in _send_soap_request(self, body, headers, retries, timeout, encoding)
42 "Content-type": "text/xml; charset=%s " % encoding
43 }
---> 44 return super(Exchange2010Service, self)._send_soap_request(body, headers=headers, retries=retries, timeout=timeout, encoding=encoding)
45
46 def _check_for_errors(self, xml_tree):

/usr/local/lib/python2.7/dist-packages/pyexchange/base/soap.pyc in _send_soap_request(self, xml, headers, retries, timeout, encoding)
63 body = etree.tostring(xml, encoding=encoding)
64
---> 65 response = self.connection.send(body, headers, retries, timeout)
66 return response
67

/usr/local/lib/python2.7/dist-packages/pyexchange/connection.pyc in send(self, body, headers, retries, timeout, encoding)
65 response.raise_for_status()
66 except requests.exceptions.RequestException as err:
---> 67 log.debug(err.response.content)
68 raise FailedExchangeException(u'Unable to connect to Exchange: %s' % err)
69

AttributeError: 'NoneType' object has no attribute 'content'

It connect to company's exchange server and Lightning is working. So I wondering how can I trouble shooting about the connections?

Testing hangs on Python 3.4

This is not some particular test, it is different tests that hang, and when debugging, it seems the testers doesn't even enter the test code. It means that the travis builds for 3.4 times out, so I'd say it is kind of important.

I investigated a little bit, and this was what I found:

Pytest

When not debugging:

it stops after test_recurrence_interval_min_value and before entering test_recurrence_must_have_end_date

When debugging:

it stops after test_can_add_resources, and before entering
test_can_assign_to_optional_attendees

With coverage:

it stops after test_canary, and before entering
test_folder_has_calendar_folder_type

But sometimes, it gets one more step, to:
test_folder_has_default_folder_type

Nosetests

Regardless of debugging, coverage or not, it goes to test_converting_tz_aware_date_returns_tz_aware_date.
However, I think there are some hints here.
If I break at that point, steps out, it seems that the debugger raises an error:
"RuntimeError: maximum recursion depth exceeded
Fatal Python error: Cannot recover from stack overflow."

Not sure where to go from here.

exchangelib -- workaround found

Last week (week of Aug. 23 or so 2017), my python scripts that use exchangelib stopped working on both Linux Ubuntu and Windows 7 64 bit. I traced the issue to this line:

account = Account(primary_smtp_address='[email protected]', credentials=credentials,autodiscover=True)

Here are the error messages:

EWS https://outlook.office365.com/EWS/Exchange.asmx, account None: Exception in _get_elements: Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/exchangelib/services.py", line 74, in _get_elements response = self._get_response_xml(payload=payload) File "/usr/local/lib/python3.5/dist-packages/exchangelib/services.py", line 161, in _get_response_xml new_version = Version.from_response(requested_api_version=api_version, response=r.text) File "/usr/local/lib/python3.5/dist-packages/exchangelib/version.py", line 248, in from_response api_version_from_server = info.get('Version') or build.api_version() File "/usr/local/lib/python3.5/dist-packages/exchangelib/version.py", line 102, in api_version return self.API_VERSION_MAP[self.major_version][self.minor_version] KeyError: 20

Traceback (most recent call last): File "365debug.py", line 16, in account = Account(primarysmtp_address='[email protected]', credentials=credentials,autodiscover=True) File "/usr/local/lib/python3.5/dist-packages/exchangelib/account.py", line 68, in _init credentials=credentials, verifyssl=verify_ssl) File "/usr/local/lib/python3.5/dist-packages/exchangelib/autodiscover.py", line 186, in discover protocol=protocol) File "/usr/local/lib/python3.5/dist-packages/exchangelib/autodiscover.py", line 330, in _autodiscover_quick verify_ssl=protocol.verify_ssl) File "/usr/local/lib/python3.5/dist-packages/exchangelib/protocol.py", line 173, in _call protocol = super(CachingProtocol, cls).call(args, *kwargs) File "/usr/local/lib/python3.5/dist-packages/exchangelib/protocol.py", line 226, in init self.version = Version.guess(self) File "/usr/local/lib/python3.5/dist-packages/exchangelib/version.py", line 194, in guess return cls._guess_version_from_service(protocol=protocol, hint=api_version) File "/usr/local/lib/python3.5/dist-packages/exchangelib/version.py", line 226, in _guess_version_from_service ResolveNames(protocol=protocol).call(unresolved_entries=[protocol.credentials.username]) File "/usr/local/lib/python3.5/dist-packages/exchangelib/services.py", line 975, in call return_full_contact_data=return_full_contact_data, File "/usr/local/lib/python3.5/dist-packages/exchangelib/services.py", line 74, in _get_elements response = self._get_response_xml(payload=payload) File "/usr/local/lib/python3.5/dist-packages/exchangelib/services.py", line 161, in _get_response_xml new_version = Version.from_response(requested_api_version=api_version, response=r.text) File "/usr/local/lib/python3.5/dist-packages/exchangelib/version.py", line 248, in from_response api_version_from_server = info.get('Version') or build.api_version() File "/usr/local/lib/python3.5/dist-packages/exchangelib/version.py", line 102, in api_version return self.API_VERSION_MAP[self.major_version][self.minor_version] KeyError: 20

UnicodeEncodeError in ntlm3\des.py

Hi,

I have successful been using pyexchange for retrieving calendar items from my company server. The last successful test was several months ago. But yesterday I got this error:

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)

I am using Python 2.7.12 |Anaconda 2.2.0 (32-bit)
I enter all relevant parameters as unicode.

Special settings for pyexchange

Hi,

I am wondering if there are any special requirements set on the Exchange server in order to have pyexchange to work?

By this I mean, if I were to modify the code to read resources, does the user need to have any special permissions? Or anyone part of the domain be able to access these resources? I see that the authentication is using NTLM, if we were to use Basic Auth to accommodate Office 365, does this mean the username should be a email id [email protected] rather than contoso.com\user ?

Creating an event with a different "status"

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.

Connection Check

Hello,
I would use pyexchange, but I don't know how exactly I connect me to the server.
In which form I must set the username and the url?
//URL = u'https://your.email.server.com.here/EWS/Exchange.asmx' <= what should I write here
//USERNAME = u'YOURDOMAIN\yourusername' <= what should I write here
When I create a new connection, can I check if the connect was sucessful?

I hope you can help me.
Best regards Jürgen alias jwxHD

Listing event calendar stopped working

I was using the latest official release (0.5) which is available with pip and everything was working as expected.

Then I needed to list events of delegate calendar. I monkey patched the schema and it worked on first try (hurray !).

So I decided to do things cleanly, make a fork, create a fix and a merge request. But then everything stopped working. After removing my code I realized that it was not my patch which broke pyexchange..

I started trying with every commit between the latest release (@a596a23) and the @Head and it turns out that the commit just after the release commit (@66f0824) is the last time the calendar list_event feature worked..

Every commit after, the feature is broken in one way or the other.. For example with commit @5960c66:

# python fetch.py
Traceback (most recent call last):
  File "fetch.py", line 103, in <module>
    print fetch()
  File "fetch.py", line 75, in fetch
    calendar_list = service.calendar().list_events(
AttributeError: 'Exchange2010CalendarService' object has no attribute 'list_events'

With later commit the Exchange server start returning 500 internal errors and with more recent commits, it always returns an empty list..

I'm trying to figure out what changed, but it seems there was a lot of refactoring in the last commits..

Any clue of what might have broken the list_event feature ?

Coordination at PyCon

Hey @got-root, this is super silly, but I couldn't find a better way to reach you. :)

Are you at PyCon by any chance? Would be awesome to meet up. I'm @trustrachel on twitter.

ImportError: cannot import name etree

Hi!

I could not import pyexchange 0.6 (installed via pip install pyexchange on babun/Cygwin on Windows 10) using ipython 2 nor 3:

Python 3.6.1 (default, Mar 24 2017, 12:50:34)
Type "copyright", "credits" or "license" for more information.

IPython 4.2.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import pyexchange
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-62c3fc218f72> in <module>()
----> 1 import pyexchange

/cygdrive/c/python36/lib/site-packages/pyexchange/__init__.py in <module>()
      6 """
      7 import logging
----> 8 from .exchange2010 import Exchange2010Service  # noqa
      9 from .connection import ExchangeNTLMAuthConnection  # noqa
     10

/cygdrive/c/python36/lib/site-packages/pyexchange/exchange2010/__init__.py in <module>()
      9 from ..base.calendar import BaseExchangeCalendarEvent, BaseExchangeCalendarService, ExchangeEventOrganizer, ExchangeEventResponse
     10 from ..base.folder import BaseExchangeFolder, BaseExchangeFolderService
---> 11 from ..base.soap import ExchangeServiceSOAP
     12 from ..exceptions import FailedExchangeException, ExchangeStaleChangeKeyException, ExchangeItemNotFoundException, ExchangeInternalServerTransientErrorException, ExchangeIrresolvableConflictException, InvalidEventType
     13 from ..compat import BASESTRING_TYPES

/cygdrive/c/python36/lib/site-packages/pyexchange/base/soap.py in <module>()
      7 import logging
      8
----> 9 from lxml import etree
     10 from lxml.builder import ElementMaker
     11 from datetime import datetime

ImportError: cannot import name 'etree'

I tried to install etree via pip:

Collecting etree
  Could not find a version that satisfies the requirement etree (from versions: )
No matching distribution found for etree

So I tried ipython2 as well:

Python 2.7.13 (default, Mar 14 2017, 23:27:55)
[GCC 5.4.0] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyexchange
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/cygdrive/c/python36/lib/site-packages/pyexchange/__init__.py", line 8, in <module>
    from .exchange2010 import Exchange2010Service  # noqa
  File "/cygdrive/c/python36/lib/site-packages/pyexchange/exchange2010/__init__.py", line 11, in <module>
    from ..base.soap import ExchangeServiceSOAP
  File "/cygdrive/c/python36/lib/site-packages/pyexchange/base/soap.py", line 9, in <module>
    from lxml import etree
ImportError: cannot import name etree

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.