0

I'm just trying to access Exchange Web Services (EWS) 2010 with Python using Alex Koshelev’s EWS-specific fork of suds (can be found on BitBucket). I found the basic Code for accessing EWS here and it is working fine so far. However when I try to implement other operations that require attributes (like the FindFolder-operation) it fails.

Here is the code I'm using:

import urllib2    

from suds.client import Client
from suds.sax.element import Element
from suds.transport.https import HttpTransport

class Transport(HttpTransport):
    def __init__(self, **kwargs):
        realm, uri = kwargs.pop('realm'), kwargs.pop('uri')
        HttpTransport.__init__(self, **kwargs)
        self.handler = urllib2.HTTPBasicAuthHandler()
        self.handler.add_password(realm=realm,
                                  user=self.options.username,
                                  passwd=self.options.password,
                                  uri=uri)
        self.urlopener = urllib2.build_opener(self.handler)

transport = Transport(realm='owa10.123together.com',
                      uri='https://owa10.123together.com',
                      username='demo10@owatest10.123together.com',
                      password='demo123!')
client = Client("https://owa10.123together.com/EWS/Services.wsdl",
                transport=transport) 

ns = ('t', 'http://schemas.microsoft.com/exchange/services/2006/types')

soap_headers = Element('RequestServerVersion', ns=ns)
soap_headers.attributes.append('Version="Exchange2010_SP1"') 
client.set_options(soapheaders=soap_headers)

address = client.factory.create('t:EmailAddress')
address.Address = 'demo10@owatest10.123together.com'

traversal = client.factory.create('t:FolderQueryTraversalType')
#traversal.Traversal = 'Deep'

#print client.service.GetUserOofSettings(address)
test =  client.service.FindFolder(traversal)
print test

When I run this code I get the following error:

suds.TypeNotFound: Type not found: 'Shallow'

I also used the logger in order to figure out the problem and it showes me the following:

DEBUG:suds.mx.literal:starting content:
(Content){
   tag = "Shallow"
   value = "Shallow"
   type = None
 }

Does anybody know here where's the problem? Is it my piece of code or is the .wsdl-file not ok? Please note that I'm a bloody in Python and especially suds. If you need some more information or code just tell me.

Thank you very much in advance!

alexhaus
  • 1
  • 1