Open audreypapin opened 6 years ago
try going to the module directory and do the following:
sudo apt-get update
sudo apt-get install python-pip
pip install -r requirements.txt
you're missing the pyews python library which is a requirement for this connector.
The base pyews dependency used is taken from there: https://github.com/skarra/pyews @damdam-s added some fixes here https://github.com/skarra/pyews/pull/2
Thus you need to install a custom version which comes from the following branch: https://github.com/damdam-s/pyews/tree/PyEWS_Events_Management
It is listed in the requirements.txt
as stated by @lukebranch
https://github.com/camptocamp/connector-exchange/blob/10.0/requirements.txt#L1
(Nevertheless, you don't need the vrcpy lib dependency as it is used for unit tests purposes only)
@audreypapin the PR https://github.com/skarra/pyews/pull/2 has not support anymore. The one @yvaucher provided you is the correct one.
Thanks all, connector exchange successfully installed.
But I do not really understand how to make it work. So I read all the documentation to understand how to set odoo for it to work.
@audreypapin you're welcome. The point is that you have to configure Exchange too. See here the docs https://github.com/camptocamp/connector-exchange/pull/9.
Don't hesitate to share improvements/bugs/whatever by creating issues on the https://github.com/camptocamp/connector-exchange repo.
I have a new incident, I'm sorry. I have this error that I can not understand:
`2018-07-31 07:40:23,609 5202 DEBUG OPTIMAV10 odoo.addons.connector_exchange.models.exchange_backend.common: export calendar events 2018-07-31 07:40:23,633 5202 DEBUG OPTIMAV10 root: Request: <?xml version="1.0" ?>
2018-07-31 07:40:23,609 5202 DEBUG OPTIMAV10 odoo.addons.connector_exchange.models.exchange_backend.common: export calendar events
2018-07-31 07:40:23,633 5202 DEBUG OPTIMAV10 root: Request: <?xml version="1.0" ?>
<soap:Envelope xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header>
<t:RequestServerVersion Version="Exchange2010_SP2"/>
<t:ExchangeImpersonation>
<t:ConnectingSID>
<t:PrincipalName>audrey.papin@optimadsi.fr</t:PrincipalName>
</t:ConnectingSID>
</t:ExchangeImpersonation>
</soap:Header>
<soap:Body>
<m:GetUserConfiguration>
<m:UserConfigurationName Name="CategoryList">
<t:DistinguishedFolderId Id="calendar"/>
</m:UserConfigurationName>
<m:UserConfigurationProperties>All</m:UserConfigurationProperties>
</m:GetUserConfiguration>
</soap:Body>
</soap:Envelope>
2018-07-31 07:40:23,634 5202 INFO OPTIMAV10 requests.packages.urllib3.connectionpool: Starting new HTTP connection (1): mel.optimadsi.fr
2018-07-31 07:40:23,747 5202 DEBUG OPTIMAV10 requests.packages.urllib3.connectionpool: "POST /autodiscover/services.wsdl HTTP/1.1" 405 112
2018-07-31 07:40:23,748 5202 ERROR OPTIMAV10 odoo.addons.base.ir.ir_cron: Call of self.env[u'exchange.backend'].cron_export_calendar(*()) failed in Job 18
Traceback (most recent call last):
File "/odoo/odoo-server/odoo/addons/base/ir/ir_cron.py", line 119, in _callback
getattr(model, method_name)(*args)
File "/odoo/custom/addons/connector_exchange/models/exchange_backend/common.py", line 151, in cron_export_calendar
backend.export_user_calendar()
File "/odoo/custom/addons/connector_exchange/models/exchange_backend/common.py", line 247, in export_user_calendar
user.create_odoo_category()
File "/odoo/custom/addons/connector_exchange/models/res_users/res_users.py", line 105, in create_odoo_category
ews.UpdateCategoryList('Odoo', 23, WellKnownFolderName.Calendar)
File "/usr/local/lib/python2.7/dist-packages/pyews/pyews.py", line 149, in UpdateCategoryList
"All")
File "/usr/local/lib/python2.7/dist-packages/pyews/pyews.py", line 132, in GetUserConfiguration
resp = req.execute()
File "/usr/local/lib/python2.7/dist-packages/pyews/ews/request_response.py", line 307, in execute
self.resp_node = self.request_server(debug=True)
File "/usr/local/lib/python2.7/dist-packages/pyews/ews/request_response.py", line 69, in request_server
return self.ews.send(r, debug)
File "/usr/local/lib/python2.7/dist-packages/pyews/pyews.py", line 650, in send
return self.soap.send(req, debug)
File "/usr/local/lib/python2.7/dist-packages/pyews/soap.py", line 104, in send
logging.debug('%s', pretty_xml(r.text.encode('utf-8')))
File "/usr/local/lib/python2.7/dist-packages/pyews/utils.py", line 46, in pretty_xml
x = xml.dom.minidom.parseString(x).toprettyxml()
File "/usr/lib/python2.7/xml/dom/minidom.py", line 1928, in parseString
return expatbuilder.parseString(string)
File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
return builder.parseString(string)
File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
parser.Parse(string, True)
ExpatError: syntax error: line 1, column 0
`
@audreypapin ,
Have got the same error.
The reason was in my case that there should be https://mymail.org/EWS/Exchange.asmx
instead of just https://mymail.org
in the Location
setting of backend. I believe it is right despite of the field's help message Address of Exchange WSDL
, which is by the way - https://mymail.org/ews/services.wsdl
Exchange returned its login page html - that the parser didn't expect of and couldn't parse
After I've fixed it - I have another error - in the same place but now it is about ExpatError: no element found: line 1, column 0
That one is because Exchange server replied me with 401 status code (Unauthorized) with empty r.text in response. (this is not actually ConnectionError that pyews
is trying to catch)
After that I found that pyews
only provides HTTPasicAuth
whereas my Exchange works with NTLM
only. More of it is here https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/authentication-and-ews-in-exchange
My plan now is to create my own connector for v11.0 (still based on oca/connector but refactored version of it) and using https://github.com/ecederstrand/exchangelib library instead of pyews
.
@iledarn Our plan for a future version of this connector is to use https://github.com/nylas/exchangelib
The expat error you face is a little issue that can be workaround-ed by exporting a contact or a calendar item.
Best
@damdam-s , I believe that https://github.com/nylas/exchangelib is just a fork of https://github.com/ecederstrand/exchangelib
I wonder why someone (nylas) has started his own project by copying Erik Cederstrand's
@damdam-s Do you have this version of connector worked?
@iledarn yes, this one is on production at our customers
@damdam-s ,
Thanks. But I don't see how to workaround authentication issue (expat just says that there is nothing to parse) unless to allow Basic Authentication
on Exchange site that might not be desirable for obvious reasons
Of course, there is a workaround - to let pyews
using requests_ntlm
@damdam-s
https://github.com/camptocamp/pyews/blob/PyEWS_Events_Management/pyews/soap.py#L94
Here, in r.status_code
I've got 401 and r.text
is therefore empty. ConnectionError
doesn't catch this kind of error.
The same is here https://github.com/camptocamp/connector-exchange/issues/12
https://github.com/camptocamp/pyews/blob/PyEWS_Events_Management/pyews/soap.py#L83
This is the reason in my case - there should be HttpNtlmAuth
instead of HTTPBasicAuth
Dependance Pyews not installable !? So i can't install this connector on my odoo.
Can you help me ?