# outlooklib
* [Description](#package-description)
* [Usage](#usage)
* [Installation](#installation)
* [License](#license)
## Package Description
Microsoft Outlook client Python package that uses the [requests](https://pypi.org/project/requests/) library.
> [!IMPORTANT]
> This packages uses pydantic~=1.0!
## Usage
* [outlooklib](#outlooklib)
from a script:
```python
import outlooklib
import pandas as pd
client_id = "123"
client_secret = "123"
tenant_id = "123"
sp_domain = "companygroup.sharepoint.com"
client_email = "team.email@company.com"
# Initialize Outlook client
outlook = outlooklib.Outlook(client_id=client_id,
tenant_id=tenant_id,
client_secret=client_secret,
sp_domain=sp_domain,
client_email=client_email,
client_folder="Inbox")
```
```python
# Retrieves a list of mail folders
response = outlook.list_folders()
if response.status_code == 200:
df = pd.DataFrame([item.dict() for item in response.content])
print(df)
```
```python
# Retrieves the top 100 messages from the specified folder, filtered by a given condition
response = outlook.list_messages(filter="isRead ne true")
if response.status_code == 200:
df = pd.DataFrame([item.dict() for item in response.content])
print(df)
```
```python
message_id = "A...A=="
response = outlook.download_message_attachment(id=message_id,
path=r"C:\Users\admin",
index=True)
if response.status_code == 200:
print("Attachment(s) downloaded successfully")
```
```python
# Deletes a message from the current folder
message_id = "A...A=="
response = outlook.delete_message(id=message_id)
if response.status_code == 204:
print("Message deleted successfully")
```
```python
outlook.change_folder(id="root")
```
## Installation
* [outlooklib](#outlooklib)
Install python and pip if you have not already.
Then run:
```bash
pip install pip --upgrade
```
For production:
```bash
pip install outlooklib
```
This will install the package and all of it's python dependencies.
If you want to install the project for development:
```bash
git clone https://github.com/aghuttun/outlooklib.git
cd outlooklib
pip install -e ".[dev]"
```
To test the development package: [Testing](#testing)
## License
* [outlooklib](#outlooklib)
BSD License (see license file)
Raw data
{
"_id": null,
"home_page": null,
"name": "outlooklib",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "Paulo Portela <portela.paulo@gmail.com>",
"keywords": "Microsoft, Outlook, Python, API, Office365, GraphAPI",
"author": null,
"author_email": "Paulo Portela <portela.paulo@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/7c/05/51ec681965feac1d33882805acc1705cb5f4627a8319d8c6ee6eee339836/outlooklib-0.0.8.tar.gz",
"platform": null,
"description": "# outlooklib\r\n\r\n* [Description](#package-description)\r\n* [Usage](#usage)\r\n* [Installation](#installation)\r\n* [License](#license)\r\n\r\n## Package Description\r\n\r\nMicrosoft Outlook client Python package that uses the [requests](https://pypi.org/project/requests/) library.\r\n\r\n> [!IMPORTANT] \r\n> This packages uses pydantic~=1.0!\r\n\r\n## Usage\r\n\r\n* [outlooklib](#outlooklib)\r\n\r\nfrom a script:\r\n\r\n```python\r\nimport outlooklib\r\nimport pandas as pd\r\n\r\nclient_id = \"123\"\r\nclient_secret = \"123\"\r\ntenant_id = \"123\"\r\nsp_domain = \"companygroup.sharepoint.com\"\r\n\r\nclient_email = \"team.email@company.com\"\r\n\r\n# Initialize Outlook client\r\noutlook = outlooklib.Outlook(client_id=client_id, \r\n tenant_id=tenant_id, \r\n client_secret=client_secret,\r\n sp_domain=sp_domain,\r\n client_email=client_email,\r\n client_folder=\"Inbox\")\r\n```\r\n\r\n```python\r\n# Retrieves a list of mail folders\r\nresponse = outlook.list_folders()\r\nif response.status_code == 200:\r\n df = pd.DataFrame([item.dict() for item in response.content])\r\n print(df)\r\n```\r\n\r\n```python\r\n# Retrieves the top 100 messages from the specified folder, filtered by a given condition\r\nresponse = outlook.list_messages(filter=\"isRead ne true\")\r\nif response.status_code == 200:\r\n df = pd.DataFrame([item.dict() for item in response.content])\r\n print(df)\r\n```\r\n\r\n```python\r\nmessage_id = \"A...A==\"\r\nresponse = outlook.download_message_attachment(id=message_id, \r\n path=r\"C:\\Users\\admin\", \r\n index=True)\r\nif response.status_code == 200:\r\n print(\"Attachment(s) downloaded successfully\")\r\n```\r\n\r\n```python\r\n# Deletes a message from the current folder\r\nmessage_id = \"A...A==\"\r\nresponse = outlook.delete_message(id=message_id)\r\nif response.status_code == 204:\r\n print(\"Message deleted successfully\")\r\n```\r\n\r\n```python\r\noutlook.change_folder(id=\"root\")\r\n```\r\n\r\n## Installation\r\n\r\n* [outlooklib](#outlooklib)\r\n\r\nInstall python and pip if you have not already.\r\n\r\nThen run:\r\n\r\n```bash\r\npip install pip --upgrade\r\n```\r\n\r\nFor production:\r\n\r\n```bash\r\npip install outlooklib\r\n```\r\n\r\nThis will install the package and all of it's python dependencies.\r\n\r\nIf you want to install the project for development:\r\n\r\n```bash\r\ngit clone https://github.com/aghuttun/outlooklib.git\r\ncd outlooklib\r\npip install -e \".[dev]\"\r\n```\r\n\r\nTo test the development package: [Testing](#testing)\r\n\r\n## License\r\n\r\n* [outlooklib](#outlooklib)\r\n\r\nBSD License (see license file)\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Microsoft Outlook client Python package that uses the requests library.",
"version": "0.0.8",
"project_urls": {
"Documentation": "https://github.com/aghuttun/outlooklib/blob/main/README.md",
"Homepage": "https://github.com/aghuttun/outlooklib"
},
"split_keywords": [
"microsoft",
" outlook",
" python",
" api",
" office365",
" graphapi"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "728ef7065afb2a5e0cc860a4f797db62da3f687f94ec9eeb37ab42834646b1a5",
"md5": "ba1f894ac0b4f84a0bb2c646953e154e",
"sha256": "e53fc79def6cf22838bf57bac4324945afc01a0dc0a44c29d9cd360eb8d6fe08"
},
"downloads": -1,
"filename": "outlooklib-0.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ba1f894ac0b4f84a0bb2c646953e154e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 8801,
"upload_time": "2025-07-25T22:32:20",
"upload_time_iso_8601": "2025-07-25T22:32:20.720340Z",
"url": "https://files.pythonhosted.org/packages/72/8e/f7065afb2a5e0cc860a4f797db62da3f687f94ec9eeb37ab42834646b1a5/outlooklib-0.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7c0551ec681965feac1d33882805acc1705cb5f4627a8319d8c6ee6eee339836",
"md5": "7c9fbefe07528504565037ec81293b90",
"sha256": "0186d94c5a2f28da4b86a4f2b5247fe890732060d91084328fe053284b351af6"
},
"downloads": -1,
"filename": "outlooklib-0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "7c9fbefe07528504565037ec81293b90",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 9428,
"upload_time": "2025-07-25T22:32:21",
"upload_time_iso_8601": "2025-07-25T22:32:21.834578Z",
"url": "https://files.pythonhosted.org/packages/7c/05/51ec681965feac1d33882805acc1705cb5f4627a8319d8c6ee6eee339836/outlooklib-0.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-25 22:32:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aghuttun",
"github_project": "outlooklib",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "outlooklib"
}