Ejemplo n.º 1
0
def main():
    logging.getLogger().setLevel(logging.DEBUG)

    global USER, PWD, EWS_URL, ews

    with open("auth.txt", "r") as inf:
        USER = inf.readline().strip()
        PWD = inf.readline().strip()
        EWS_URL = inf.readline().strip()

        logging.debug("Username: %s; Url: %s", USER, EWS_URL)

    creds = WebCredentials(USER, PWD)
    ews = ExchangeService()
    ews.credentials = creds

    try:
        ews.AutoDiscoverUrl()
    except ExchangeAutoDiscoverError as e:
        logging.info("ExchangeAutoDiscoverError: %s", e)
        logging.info("Falling back on manual url setting.")
        ews.Url = EWS_URL

    ews.init_soap_client()

    root = bind()
    # cfs = root.FindFolders(types=FolderClass.Contacts)

    # test_create_folder(root)
    # test_find_item(cons[0].itemid.text)

    # test_create_item(ews, cfs[0].Id)

    cons = test_list_items(root, ids_only=True)
Ejemplo n.º 2
0
    def ews_init (self):
        logging.debug('Username: %s; Url: %s', self.user, self.url)

        creds = WebCredentials(self.user, self.pw)
        ews = ExchangeService()
        ews.credentials = creds

        try:
            ews.AutoDiscoverUrl()
        except ExchangeAutoDiscoverError as e:
            logging.info('ExchangeAutoDiscoverError: %s', e)
            logging.info('Falling back on manual url setting.')
            ews.Url = self.url

        ews.init_soap_client()
        self.set_ews(ews)
Ejemplo n.º 3
0
def main():
    logging.getLogger().setLevel(logging.DEBUG)

    global USER, PWD, EWS_URL, ews

    with open('auth.txt', 'r') as inf:
        USER = inf.readline().strip()
        PWD = inf.readline().strip()
        EWS_URL = inf.readline().strip()

        logging.debug('Username: %s; Url: %s', USER, EWS_URL)

    creds = WebCredentials(USER, PWD)
    ews = ExchangeService()
    ews.credentials = creds

    try:
        ews.AutoDiscoverUrl()
    except ExchangeAutoDiscoverError as e:
        logging.info('ExchangeAutoDiscoverError: %s', e)
        logging.info('Falling back on manual url setting.')
        ews.Url = EWS_URL

    ews.init_soap_client()

    root = bind()
    # cfs = root.FindFolders(types=FolderClass.Contacts)

    # test_create_folder(root)
    # test_find_item(cons[0].itemid.text)

    # test_create_item(ews, cfs[0].Id)

    cons = test_list_items(root, ids_only=True)
Ejemplo n.º 4
0
    def ews_init(self):
        logging.debug('Username: %s; Url: %s', self.user, self.url)

        creds = WebCredentials(self.user, self.pw)
        ews = ExchangeService()
        ews.credentials = creds

        try:
            ews.AutoDiscoverUrl()
        except ExchangeAutoDiscoverError as e:
            logging.info('ExchangeAutoDiscoverError: %s', e)
            logging.info('Falling back on manual url setting.')
            ews.Url = self.url

        ews.init_soap_client()
        self.set_ews(ews)