https://github.com/o365/python-o365
A simple python library to interact with Microsoft Graph and Office 365 API
https://github.com/o365/python-o365
addressbook calendar calendars email excel graph mailbox microsoft microsoft-api microsoft-graph-api microsoft-teams oauth oauth-authentication office-365-rest-api onedrive outlook planner python sharepoint
Last synced: 14 days ago
JSON representation
A simple python library to interact with Microsoft Graph and Office 365 API
- Host: GitHub
- URL: https://github.com/o365/python-o365
- Owner: O365
- License: apache-2.0
- Created: 2015-02-18T10:50:04.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2025-04-08T16:30:18.000Z (14 days ago)
- Last Synced: 2025-04-08T20:13:02.442Z (14 days ago)
- Topics: addressbook, calendar, calendars, email, excel, graph, mailbox, microsoft, microsoft-api, microsoft-graph-api, microsoft-teams, oauth, oauth-authentication, office-365-rest-api, onedrive, outlook, planner, python, sharepoint
- Language: Python
- Homepage:
- Size: 13.9 MB
- Stars: 1,770
- Watchers: 45
- Forks: 432
- Open Issues: 59
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pepy.tech/project/O365)
[](https://pypi.python.org/pypi/O365)
[](https://pypi.python.org/pypi/O365/)# O365 - Microsoft Graph and Office 365 API made easy
This project aims to make interacting with Microsoft Graph and Office 365 easy to do in a Pythonic way.
Access to Email, Calendar, Contacts, OneDrive, etc. Are easy to do in a way that feel easy and straight forward to beginners and feels just right to seasoned python programmer.The project is currently developed and maintained by [alejcas](https://github.com/alejcas).
#### Core developers
- [Alejcas](https://github.com/alejcas)
- [Toben Archer](https://github.com/Narcolapser)
- [Geethanadh](https://github.com/GeethanadhP)**We are always open to new pull requests!**
## Detailed docs and api reference on [O365 Docs site](https://o365.github.io/python-o365/latest/index.html)
### Quick example on sending a message:
```python
from O365 import Accountcredentials = ('client_id', 'client_secret')
account = Account(credentials)
m = account.new_message()
m.to.add('[email protected]')
m.subject = 'Testing!'
m.body = "George Best quote: I've stopped drinking, but only while I'm asleep."
m.send()
```### Why choose O365?
- Almost Full Support for MsGraph and Office 365 Rest Api.
- Good Abstraction layer between each Api. Change the api (Graph vs Office365) and don't worry about the api internal implementation.
- Full oauth support with automatic handling of refresh tokens.
- Automatic handling between local datetimes and server datetimes. Work with your local datetime and let this library do the rest.
- Change between different resource with ease: access shared mailboxes, other users resources, SharePoint resources, etc.
- Pagination support through a custom iterator that handles future requests automatically. Request Infinite items!
- A query helper to help you build custom OData queries (filter, order, select and search).
- Modular ApiComponents can be created and built to achieve further functionality.___
This project was also a learning resource for us. This is a list of not so common python idioms used in this project:
- New unpacking technics: `def method(argument, *, with_name=None, **other_params):`
- Enums: `from enum import Enum`
- Factory paradigm
- Package organization
- Timezone conversion and timezone aware datetimes
- Etc. ([see the code!](https://github.com/O365/python-o365/tree/master/O365))