<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii"><title>Here is a working exchange example</title>
</head>
<body>
<font face="Calibri, Verdana, Helvetica, Arial"><span style="font-size:11pt">Thanks to all those that helped!<br>
<br>
Here is a very basic example to talk to exchange. Be aware that you also have to patch the Services.wsdl file to include these lines:<br>
Put these lines at the bottom of Services.wsdl before the closing &lt;/wsdl:definitions&gt;:<br>
<br>
&lt;wsdl:service name=&quot;ExchangeWebService&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;wsdl:port name=&quot;ExchangeWebPort&quot; binding=&quot;tns:ExchangeServiceBinding&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;soap:address location=&quot;<a href="https://mail.gemini.edu/EWS/Exchange.asmx&quot;&gt;&lt;/soap:address">https://mail.gemini.edu/EWS/Exchange.asmx&quot;&gt;&lt;/soap:address</a>&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/wsdl:port&gt;<br>
&lt;/wsdl:service&gt;<br>
<br>
The first xml definition and attr = c.service.CreateItem(__inject={'msg':xml}) call will generate an email.<br>
The second xml definition and attr = c.service.ResolveNames(__inject={'msg':t}) will perform a user lookup<br>
<br>
import suds<br>
from suds.client import Client<br>
from suds.transport.https import WindowsHttpAuthenticated<br>
<br>
import logging<br>
logging.basicConfig(level=logging.INFO)<br>
logging.getLogger('suds.client').setLevel(logging.DEBUG)<br>
<br>
<br>
url = &quot;<a href="file:///path/to/Services.wsdl">file:///path/to/Services.wsdl</a>&quot;<br>
user = 'DOMAIN\user'<br>
password = &quot;pass&quot;<br>
<br>
ntlm = WindowsHttpAuthenticated(username=user,password=password)<br>
c = Client(url, transport=ntlm)<br>
<br>
xml = '''<br>
&lt;soap:Envelope xmlns:soap=&quot;<a href="http://">http://</a>schemas.xmlsoap.org/soap/envelope/&quot; xmlns:xsi=&quot;<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>&quot; xmlns:xsd=&quot;<a href="http://www.w3.org/2001/XMLSchema&quot;">http://www.w3.org/2001/XMLSchema&quot;</a>&gt;<br>
&lt;soap:Body&gt;<br>
&nbsp;&nbsp;&lt;CreateItem MessageDisposition=&quot;SendAndSaveCopy&quot; xmlns=&quot;<a href="http://">http://</a>schemas.microsoft.com/exchange/services/2006/messages&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;SavedItemFolderId&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;DistinguishedFolderId Id=&quot;sentitems&quot; xmlns=&quot;<a href="http://">http://</a>schemas.microsoft.com/exchange/services/2006/types&quot;/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/SavedItemFolderId&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;Items&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Message xmlns=&quot;<a href="http://">http://</a>schemas.microsoft.com/exchange/services/2006/types&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ItemClass&gt;IPM.Note&lt;/ItemClass&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Subject&gt;Sent via Python-&gt;Exchange-&gt;EWS&lt;/Subject&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Body BodyType=&quot;Text&quot;&gt;This message has been sent to you via Python, Exchange and EWS :)&lt;/Body&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ToRecipients&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Mailbox&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;EmailAddress&gt;<a href="jeckersley@gemini.edu&lt;/EmailAddress">jeckersley@gemini.edu&lt;/EmailAddress</a>&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Mailbox&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ToRecipients&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Message&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Items&gt;<br>
&nbsp;&nbsp;&lt;/CreateItem&gt;<br>
&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;'''<br>
#attr = c.service.CreateItem(__inject={'msg':xml})<br>
<br>
xml = '''<br>
&lt;soap:Envelope xmlns:xsi=&quot;<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>&quot; xmlns:xsd=&quot;<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>&quot; xmlns:soap=&quot;<a href="http://">http://</a>schemas.xmlsoap.org/soap/envelope/&quot; xmlns:t=&quot;<a href="http://">http://</a>schemas.microsoft.com/exchange/services/2006/types&quot;&gt;<br>
&nbsp;&nbsp;&lt;soap:Body&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;ResolveNames xmlns=&quot;<a href="http://">http://</a>schemas.microsoft.com/exchange/services/2006/messages&quot; xmlns:t=&quot;<a href="http://">http://</a>schemas.microsoft.com/exchange/services/2006/types&quot; ReturnFullContactData=&quot;true&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;UnresolvedEntry&gt;jeckersley&lt;/UnresolvedEntry&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ResolveNames&gt;<br>
&nbsp;&nbsp;&lt;/soap:Body&gt;<br>
&lt;/soap:Envelope&gt;<br>
'''<br>
attr = c.service.ResolveNames(__inject={'msg':t})<br>
<br>
print attr</span></font>
</body>
</html>