Client for Microsoft Exchange Web Services (EWS)
Project description
This module provides an well-performing interface for communicating with a Microsoft Exchange 2007-2016 Server or Office365 using Exchange Web Services (EWS). It currently only implements autodiscover and functions for manipulating calendar items.
Usage
Here is a simple example that inserts, retrieves and deletes calendar items in an Exchange calendar:
from exchangelib import DELEGATE, services
from exchangelib.configuration import Configuration
from exchangelib.account import Account
from exchangelib.ewsdatetime import EWSDateTime, EWSTimeZone
from exchangelib.folders import CalendarItem
year, month, day = 2016, 3, 20
tz = EWSTimeZone.timezone('Europe/Copenhagen')
calendar_items = []
for hour in range(7, 17):
calendar_items.append(CalendarItem(
start=tz.localize(EWSDateTime(year, month, day, hour, 30)),
end=tz.localize(EWSDateTime(year, month, day, hour+1, 15)),
subject='Test item',
body='Hello from Python',
location='devnull',
categories=['foo', 'bar'],
))
config = Configuration(username='MYWINDOMAIN\myusername', password='topsecret')
account = Account(primary_smtp_address='john@example.com', config=config, autodiscover=True, access_type=DELEGATE)
res = account.calendar.add_items(calendar_items)
print(res)
ids = account.calendar.find_items(
start=tz.localize(EWSDateTime(year, month, day)),
end=tz.localize(EWSDateTime(year, month, day+1)),
categories=['foo', 'bar'],
shape=services.IdOnly,
)
print(ids)
res = account.calendar.delete_items(ids)
print(res)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
exchangelib-1.3.1.tar.gz
(41.9 kB
view details)
File details
Details for the file exchangelib-1.3.1.tar.gz.
File metadata
- Download URL: exchangelib-1.3.1.tar.gz
- Upload date:
- Size: 41.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee12bbbdf47e31adbd16eb00d48c66f5d47d88cea06addf993ebfde8cddbb137
|
|
| MD5 |
0287716fcfb59b47250376549a9df0a8
|
|
| BLAKE2b-256 |
8e544cfebc7f7bc52e5ca033e6f9c10c58f40fd3a1e8557beae0c262800adf46
|