Hi Erik,
This is what I get when I run your script:
python demo.py
Traceback (most recent call last):
File "demo.py", line 11, in <module>
exchange = Exchange(domain=domain, username=user, password=pw,
datadir=datadir)
File "/Users/jeckersley/Sites/geminiDigest/Exchange.py", line 79, in
__init__
self.version = self.Version(self)
File "/Users/jeckersley/Sites/geminiDigest/Exchange.py", line 136, in
__init__
self.minorbuildnumber = self.get()
File "/Users/jeckersley/Sites/geminiDigest/Exchange.py", line 203, in get
header = ElementTree.fromstring(response).find('{%s}Header' % soapns)
File
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/
etree/ElementTree.py", line 964, in XML
return parser.close()
File
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/
etree/ElementTree.py", line 1254, in close
self._parser.Parse("", 1) # end of data
xml.parsers.expat.ExpatError: no element found: line 1, column 0
- Jared
On 7/22/10 9:49 PM, "Erik Cederstrand" <erik(a)cederstrand.dk> wrote:
Hi Jared,
Den 23/07/2010 kl. 09.22 skrev Jared Eckersley:
> I was able to manually remove the python-ntlm library and reinstall and got
> it working again.
Great. Could you try my script again and see if it works for you?
> createitem = Element('CreateItem')
[...]
> attr = c.service.CreateItem(createitem)
CreateItem() takes as arguments the elements within createitem, i.e.
'saveditemfolderid' and 'items'. You shouldn't create the
'createitem'
element. If you look at your XML, you have the CreateItem tag twice:
> <ns1:CreateItem>
> <CreateItem MessageDisposition="SendAndSaveCopy"
>
xmlns="http://schemas.microsoft.com/exchange/services/2006/messages&...
Your namespace usage is also funky. You need to clean that up if you get more
'Invalid request' messages.
Finally, you can't use the factory methods, since CreateItem expects the
attribute MessageDisposition, and Suds doesn't support that without the patch
in ticket #21. Generate the full XML instead (including headers) and inject
it:
c.service.CreateItem(__inject={'msg':xml})
Thanks,
Erik