Guest User

Untitled

a guest
Nov 2nd, 2017
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. from exchangelib import DELEGATE, Account, Credentials
  2.  
  3. creds = Credentials(
  4. username='MYWINDOMAIN\myusername',
  5. password='topsecret')
  6. account = Account(
  7. primary_smtp_address='john@example.com',
  8. credentials=creds,
  9. autodiscover=True,
  10. access_type=DELEGATE)
  11.  
  12. # Print first 100 inbox messages in reverse order
  13. for item in account.inbox.all().order_by('-datetime_received')[:100]:
  14. print(item.subject, item.body, item.attachments)
Add Comment
Please, Sign In to add comment