# MSPlanner Tools Documentation
MSPlanner Tools is a Python library designed to streamline interactions with Microsoft Planner via the Microsoft Graph API. This documentation provides an overview of the library's features, focusing on Authentication and managing OAuth2 tokens using the TokenManager class.
### Project Repository
To further details and better navigation visit the project page on [Github.](https://github.com/MigueldsBatista/msplanner-tools)
### Learn how you can contribute
[Contributing](https://github.com/MigueldsBatista/msplanner-tools/blob/main/contributing.md)
## Overview
* <a href="#authentication">Authentication</a>
* <a href="#plans">Plans</a>
* <a href="#tasks">Tasks</a>
* <a href="#buckets">Buckets</a>
* <a href="#users">Users</a>
## Overview
* <a href="#authentication"><p>Authentication</p></a>
* <a href="#plans"><p>Plans</p></a>
* <a href="#tasks"><p>Tasks</p></a>
* <a href="#buckets">Buckets</p></a>
* <a href="#users"><p>Users</p></a>
---
# Authentication
The TokenManager class provides a robust way to handle authentication and token management for accessing the Microsoft Graph API. This is essential for secure and seamless communication with Microsoft Planner.
### Features of TokenManager
- Automatically manages OAuth2 tokens for authentication.
- Requests new tokens when the current token expires.
- Supports Azure Active Directory authentication using the Microsoft Authentication Library (MSAL).
### Prerequisites
Before using the TokenManager class, ensure you have the following:
- **Client ID**: Obtain from your Azure AD app registration.
- **Client Secret**: Set up in your Azure AD app registration.
- **Tenant ID**: Find this in your Azure Active Directory overview.
### Usage
Here's how to use the TokenManager class for authentication:
#### Import and Initialize
```python
from msplanner_tools.authentication import TokenManager
# Replace with your Azure AD app credentials
client_id = 'your_client_id'
client_secret = 'your_client_secret'
tenant_id = 'your_tenant_id'
```
If you don't know how to register an Azure app, visit [Microsoft how to register an app guide](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/walkthrough-register-app-azure-active-directory).
**Permissions:**
- Group.ReadWrite.All
- Tasks.ReadWrite.All
- User.ReadBasic.All
Here is an example on how to use the TokenManager class:
```python
# Initialize the TokenManager
token_manager = TokenManager(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id)
# Get a valid access token
access_token = token_manager.get_token()
print(f'Access Token: {access_token}')
# The get_token method ensures that a valid token is always returned, automatically handling token expiration.
```
**Token Management Details**
- **Request a New Token**: If the token has expired or is unavailable, a new token is automatically requested using `request_new_token`.
- **Expiration Handling**: The class keeps track of the token's expiration time and validates it using `is_token_expired`.
## Example Workflow
```python
# Using the token in an API request
import requests
# Get the access token
access_token = token_manager.get_token()
# Set up the headers for Microsoft Graph API requests
headers = {
'Authorization': f'Bearer {access_token}',
'Content-Type': 'application/json'
}
```
### Example: Create a new plan
```python
from msplanner_tools.plans import create_plan
from msplanner_tools.auth import TokenManager
token_manager = TokenManager(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id)
plan_id = create_plan("my new plan", "my_group_id", token_manager.get_token())
if plan_id:
print("Plan successfully created!")
```
**References**
- [MSAL Python Documentation](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-overview)
- [Microsoft Graph API Overview](https://docs.microsoft.com/en-us/graph/overview)
---
# Plans
This section focuses on managing Microsoft Planner plans using the functions provided in the `msplanner_tools.plans` module.
<br>
[Return to the top](#authentication)
## Plans Management
The `msplanner_tools.plans` module provides functions to create, retrieve, update, and delete plans in Microsoft Planner via the Microsoft Graph API.
### Functions Overview
#### `create_plan`
Creates a new plan in Microsoft Planner.
**Parameters:**
- `plan_name` (str): Name of the plan to be created.
- `group_id` (str): ID of the group to which the plan belongs.
- `access_token`: Access token for the Microsoft Graph API.
**Returns:**
- `str`: ID of the created plan.
**Example:**
```python
from msplanner_tools.plans import create_plan
from msplanner_tools.auth import TokenManager
token_manager = TokenManager(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id)
plan_id = create_plan("my new plan", "my_group_id", token_manager.get_token())
if plan_id:
print("Plan successfully created!")
```
#### `get_plan_by_id`
Retrieves a plan based on its ID.
**Parameters:**
- `plan_id` (str): ID of the plan.
- `access_token`: Access token for the Microsoft Graph API.
**Returns:**
- `dict`: Dictionary containing the plan data.
**Example:**
```python
from msplanner_tools.plans import get_plan_by_id
plan = get_plan_by_id("plan_id", token_manager.get_token())
print(plan)
```
#### `update_plan_by_id`
Updates a plan based on its ID and name.
**Parameters:**
- `plan_id` (str): ID of the plan.
- `plan_name` (str): New name of the plan.
- `access_token`: Access token for the Microsoft Graph API.
**Returns:**
- `None`
**Example:**
```python
from msplanner_tools.plans import update_plan_by_id
update_plan_by_id("plan_id", "updated plan name", token_manager.get_token())
print("Plan updated successfully.")
```
#### `delete_plan_by_id`
Deletes a plan based on its ID.
**Parameters:**
- `plan_id` (str): ID of the plan to be deleted.
- `access_token`: Access token for the Microsoft Graph API.
**Returns:**
- `None`
**Example:**
```python
from msplanner_tools.plans import delete_plan_by_id
delete_plan_by_id("plan_id", token_manager.get_token())
print("Plan deleted successfully.")
```
#### `get_plans_by_group_id`
Returns a list of all plans in a group.
**Parameters:**
- `group_id` (str): ID of the group.
- `access_token`: Access token for the Microsoft Graph API.
**Returns:**
- `list`: List of plans in the group.
**Example:**
```python
from msplanner_tools.plans import get_plans_by_group_id
plans = get_plans_by_group_id("group_id", token_manager.get_token())
print(plans)
```
#### `list_plan_tasks_by_id`
Returns a list of all tasks in a plan.
**Parameters:**
- `plan_id` (str): ID of the plan.
- `access_token`: Access token for the Microsoft Graph API.
**Returns:**
- `list`: List of tasks in the plan.
**Example:**
```python
from msplanner_tools.plans import list_plan_tasks_by_id
tasks = list_plan_tasks_by_id("plan_id", token_manager.get_token())
print(tasks)
```
**References**
- [MSAL Python Documentation](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-overview)
- [Microsoft Graph API Overview](https://docs.microsoft.com/en-us/graph/overview)
Next, continue to Tasks and Buckets for interacting with Microsoft Planner resources.
---
# Tasks
This section focuses on managing Microsoft Planner tasks using the functions provided in the `msplanner_tools.tasks` module.
<br>
[Return to the top](#authentication)
## Tasks Management
The `msplanner_tools.tasks` module provides functions to create, retrieve, update, and delete tasks in Microsoft Planner via the Microsoft Graph API.
### Functions Overview
#### `create_task`
Creates a new task in Microsoft Planner.
**Parameters:**
- `item_list` (dict): Dictionary with the task data:
- `title` (str): Task name.
- `assignments` (list): List of owners' emails.
- `startDateTime` (str): Task start date in the format `YYYY-MM-DDTHH:MM:SSZ`.
- `dueDateTime` (str): Task due date in the format `YYYY-MM-DDTHH:MM:SSZ`.
- `priority` (int): Task priority (1-5).
- `labels_list` (list): List of labels in the format `['category1', 'category2', ...]`.
- `bucket_id` (str): ID of the bucket to which the task belongs.
- `plan_id` (str): ID of the plan to which the task belongs.
- `access_token` (str): Access token for the Microsoft Graph API.
- `group_id` (str): ID of the group to which the task belongs.
**Returns:**
- `str`: ID of the created task.
**Example:**
```python
from msplanner_tools.tasks import create_task
from msplanner_tools.auth import TokenManager
token_manager = TokenManager(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id)
item_list = {
"title": "New Task",
"assignments": ["owner@example.com"],
"startDateTime": "2023-01-01T00:00:00Z",
"dueDateTime": "2023-01-10T00:00:00Z",
"priority": 1,
"labels_list": ["category1", "category2"]
}
task_id = create_task(item_list, "bucket_id", "plan_id", token_manager.get_token(), "group_id")
if task_id:
print("Task successfully created!")
```
#### `update_task_details`
Updates a task based on its ID, task data, ETag, and access token.
**Parameters:**
- `task_id` (str): ID of the task to be updated.
- `item_list` (dict): Dictionary with the task data to be updated.
- `etag` (str): ETag value of the task, obtained with the `get_task_etag` function.
- `access_token` (str): Access token for the Microsoft Graph API.
**Returns:**
- `None`
**Example:**
```python
from msplanner_tools.tasks import update_task_details
from msplanner_tools.auth import TokenManager
token_manager = TokenManager(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id)
item_list = {
"description": "Updated task description",
"checklist": ["item1", "item2"]
}
etag = "etag_value"
update_task_details("task_id", item_list, etag, token_manager.get_token())
print("Task updated successfully.")
```
## References
- [MSAL Python Documentation](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-python)
- [Microsoft Graph API Overview](https://docs.microsoft.com/en-us/graph/overview)
Next, continue to [Buckets](buckets.md) for interacting with Microsoft Planner resources.
---
# Buckets
The `msplanner_tools.buckets` module provides functions to create, retrieve, and delete buckets in Microsoft Planner via the Microsoft Graph API.
<br>
[Return to the top](#authentication)
### Functions Overview
#### `create_bucket`
Creates a new bucket in Microsoft Planner.
**Parameters:**
- `bucket_name` (str): Name of the bucket to be created.
- `plan_id` (str): ID of the plan to which the bucket belongs.
- `access_token` (str): Access token for the Microsoft Graph API.
- `bucket_num` (int): Number of the bucket to be created (starts at 0).
**Returns:**
- `str`: ID of the created bucket.
**Example:**
```python
from msplanner_tools.buckets import create_bucket
from msplanner_tools.auth import TokenManager
token_manager = TokenManager(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id)
bucket_id = create_bucket("New Bucket", "plan_id", token_manager.get_token(), 0)
if bucket_id:
print("Bucket successfully created!")
```
#### `delete_bucket_by_id`
Deletes a bucket based on its ID.
**Parameters:**
- `bucket_id` (str): ID of the bucket to be deleted.
- `access_token` (str): Access token for the Microsoft Graph API.
**Returns:**
- `None`
**Example:**
```python
from msplanner_tools.buckets import delete_bucket_by_id
from msplanner_tools.auth import TokenManager
token_manager = TokenManager(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id)
delete_bucket_by_id("bucket_id", token_manager.get_token())
print("Bucket deleted successfully.")
```
## References
- [MSAL Python Documentation](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-python)
- [Microsoft Graph API Overview](https://docs.microsoft.com/en-us/graph/overview)
---
# Users
This section focuses on managing Microsoft Planner users using the functions provided in the `msplanner_tools.users` module.
<br>
[Return to the top](#authentication)
## Users Management
The `msplanner_tools.users` module provides functions to retrieve user information from Microsoft Planner via the Microsoft Graph API.
### Functions Overview
#### `find_user_id_by_email`
Finds a user ID based on their email address.
**Parameters:**
- `email` (str): Email address of the user.
- `group_id` (str): ID of the group to which the user belongs.
- `access_token` (str): Access token for the Microsoft Graph API.
**Returns:**
- `str`: ID of the user.
**Example:**
```python
from msplanner_tools.users import find_user_id_by_email
from msplanner_tools.auth import TokenManager
token_manager = TokenManager(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id)
user_id = find_user_id_by_email("user@example.com", "group_id", token_manager.get_token())
print(f'User ID: {user_id}')
```
**References**
- [MSAL Python Documentation](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-overview)
- [Microsoft Graph API Overview](https://docs.microsoft.com/en-us/graph/overview)
Raw data
{
"_id": null,
"home_page": "https://github.com/MigueldsBatista/msplanner-tools",
"name": "msplanner-tools",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "Microsoft Planner, API, Graph, Python, Tasks, Buckets, Plans",
"author": "Miguel Batista",
"author_email": "miguelsbatista0610@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/20/cf/c03df437a961e00aeee64023d765f6b8141f1e628cc01bdbd3865efd665e/msplanner-tools-0.1.93.tar.gz",
"platform": null,
"description": "# MSPlanner Tools Documentation\nMSPlanner Tools is a Python library designed to streamline interactions with Microsoft Planner via the Microsoft Graph API. This documentation provides an overview of the library's features, focusing on Authentication and managing OAuth2 tokens using the TokenManager class.\n\n### Project Repository\nTo further details and better navigation visit the project page on [Github.](https://github.com/MigueldsBatista/msplanner-tools)\n\n### Learn how you can contribute\n[Contributing](https://github.com/MigueldsBatista/msplanner-tools/blob/main/contributing.md)\n\n## Overview\n* <a href=\"#authentication\">Authentication</a>\n* <a href=\"#plans\">Plans</a>\n* <a href=\"#tasks\">Tasks</a>\n* <a href=\"#buckets\">Buckets</a>\n* <a href=\"#users\">Users</a>\n\n## Overview\n* <a href=\"#authentication\"><p>Authentication</p></a>\n* <a href=\"#plans\"><p>Plans</p></a>\n* <a href=\"#tasks\"><p>Tasks</p></a>\n* <a href=\"#buckets\">Buckets</p></a>\n* <a href=\"#users\"><p>Users</p></a>\n\n---\n# Authentication\n\nThe TokenManager class provides a robust way to handle authentication and token management for accessing the Microsoft Graph API. This is essential for secure and seamless communication with Microsoft Planner.\n\n### Features of TokenManager\n- Automatically manages OAuth2 tokens for authentication.\n- Requests new tokens when the current token expires.\n- Supports Azure Active Directory authentication using the Microsoft Authentication Library (MSAL).\n\n### Prerequisites\nBefore using the TokenManager class, ensure you have the following:\n- **Client ID**: Obtain from your Azure AD app registration.\n- **Client Secret**: Set up in your Azure AD app registration.\n- **Tenant ID**: Find this in your Azure Active Directory overview.\n\n### Usage\nHere's how to use the TokenManager class for authentication:\n\n#### Import and Initialize\n```python\nfrom msplanner_tools.authentication import TokenManager\n\n# Replace with your Azure AD app credentials\nclient_id = 'your_client_id'\nclient_secret = 'your_client_secret'\ntenant_id = 'your_tenant_id'\n```\n\nIf you don't know how to register an Azure app, visit [Microsoft how to register an app guide](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/walkthrough-register-app-azure-active-directory).\n\n**Permissions:**\n- Group.ReadWrite.All\n- Tasks.ReadWrite.All\n- User.ReadBasic.All\n\nHere is an example on how to use the TokenManager class:\n\n```python\n# Initialize the TokenManager\ntoken_manager = TokenManager(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id)\n\n# Get a valid access token\naccess_token = token_manager.get_token()\nprint(f'Access Token: {access_token}')\n# The get_token method ensures that a valid token is always returned, automatically handling token expiration.\n```\n\n**Token Management Details**\n- **Request a New Token**: If the token has expired or is unavailable, a new token is automatically requested using `request_new_token`.\n- **Expiration Handling**: The class keeps track of the token's expiration time and validates it using `is_token_expired`.\n\n## Example Workflow\n```python\n# Using the token in an API request\nimport requests\n\n# Get the access token\naccess_token = token_manager.get_token()\n\n# Set up the headers for Microsoft Graph API requests\nheaders = {\n 'Authorization': f'Bearer {access_token}',\n 'Content-Type': 'application/json'\n}\n```\n\n### Example: Create a new plan\n```python\nfrom msplanner_tools.plans import create_plan\nfrom msplanner_tools.auth import TokenManager\n\ntoken_manager = TokenManager(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id)\n\nplan_id = create_plan(\"my new plan\", \"my_group_id\", token_manager.get_token())\n\nif plan_id:\n print(\"Plan successfully created!\")\n```\n\n**References**\n- [MSAL Python Documentation](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-overview)\n- [Microsoft Graph API Overview](https://docs.microsoft.com/en-us/graph/overview)\n\n---\n# Plans\n\nThis section focuses on managing Microsoft Planner plans using the functions provided in the `msplanner_tools.plans` module.\n<br>\n[Return to the top](#authentication)\n## Plans Management\nThe `msplanner_tools.plans` module provides functions to create, retrieve, update, and delete plans in Microsoft Planner via the Microsoft Graph API.\n\n### Functions Overview\n\n#### `create_plan`\nCreates a new plan in Microsoft Planner.\n\n**Parameters:**\n- `plan_name` (str): Name of the plan to be created.\n- `group_id` (str): ID of the group to which the plan belongs.\n- `access_token`: Access token for the Microsoft Graph API.\n\n**Returns:**\n- `str`: ID of the created plan.\n\n**Example:**\n```python\nfrom msplanner_tools.plans import create_plan\nfrom msplanner_tools.auth import TokenManager\n\ntoken_manager = TokenManager(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id)\nplan_id = create_plan(\"my new plan\", \"my_group_id\", token_manager.get_token())\n\nif plan_id:\n print(\"Plan successfully created!\")\n```\n\n#### `get_plan_by_id`\nRetrieves a plan based on its ID.\n\n**Parameters:**\n- `plan_id` (str): ID of the plan.\n- `access_token`: Access token for the Microsoft Graph API.\n\n**Returns:**\n- `dict`: Dictionary containing the plan data.\n\n**Example:**\n```python\nfrom msplanner_tools.plans import get_plan_by_id\n\nplan = get_plan_by_id(\"plan_id\", token_manager.get_token())\nprint(plan)\n```\n\n#### `update_plan_by_id`\nUpdates a plan based on its ID and name.\n\n**Parameters:**\n- `plan_id` (str): ID of the plan.\n- `plan_name` (str): New name of the plan.\n- `access_token`: Access token for the Microsoft Graph API.\n\n**Returns:**\n- `None`\n\n**Example:**\n```python\nfrom msplanner_tools.plans import update_plan_by_id\n\nupdate_plan_by_id(\"plan_id\", \"updated plan name\", token_manager.get_token())\nprint(\"Plan updated successfully.\")\n```\n\n#### `delete_plan_by_id`\nDeletes a plan based on its ID.\n\n**Parameters:**\n- `plan_id` (str): ID of the plan to be deleted.\n- `access_token`: Access token for the Microsoft Graph API.\n\n**Returns:**\n- `None`\n\n**Example:**\n```python\nfrom msplanner_tools.plans import delete_plan_by_id\n\ndelete_plan_by_id(\"plan_id\", token_manager.get_token())\nprint(\"Plan deleted successfully.\")\n```\n\n#### `get_plans_by_group_id`\nReturns a list of all plans in a group.\n\n**Parameters:**\n- `group_id` (str): ID of the group.\n- `access_token`: Access token for the Microsoft Graph API.\n\n**Returns:**\n- `list`: List of plans in the group.\n\n**Example:**\n```python\nfrom msplanner_tools.plans import get_plans_by_group_id\n\nplans = get_plans_by_group_id(\"group_id\", token_manager.get_token())\nprint(plans)\n```\n\n#### `list_plan_tasks_by_id`\nReturns a list of all tasks in a plan.\n\n**Parameters:**\n- `plan_id` (str): ID of the plan.\n- `access_token`: Access token for the Microsoft Graph API.\n\n**Returns:**\n- `list`: List of tasks in the plan.\n\n**Example:**\n```python\nfrom msplanner_tools.plans import list_plan_tasks_by_id\n\ntasks = list_plan_tasks_by_id(\"plan_id\", token_manager.get_token())\nprint(tasks)\n```\n\n**References**\n- [MSAL Python Documentation](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-overview)\n- [Microsoft Graph API Overview](https://docs.microsoft.com/en-us/graph/overview)\n\nNext, continue to Tasks and Buckets for interacting with Microsoft Planner resources.\n---\n# Tasks\n\nThis section focuses on managing Microsoft Planner tasks using the functions provided in the `msplanner_tools.tasks` module.\n<br>\n[Return to the top](#authentication)\n\n## Tasks Management\n\nThe `msplanner_tools.tasks` module provides functions to create, retrieve, update, and delete tasks in Microsoft Planner via the Microsoft Graph API.\n\n### Functions Overview\n\n#### `create_task`\n\nCreates a new task in Microsoft Planner.\n\n**Parameters:**\n- `item_list` (dict): Dictionary with the task data:\n - `title` (str): Task name.\n - `assignments` (list): List of owners' emails.\n - `startDateTime` (str): Task start date in the format `YYYY-MM-DDTHH:MM:SSZ`.\n - `dueDateTime` (str): Task due date in the format `YYYY-MM-DDTHH:MM:SSZ`.\n - `priority` (int): Task priority (1-5).\n - `labels_list` (list): List of labels in the format `['category1', 'category2', ...]`.\n- `bucket_id` (str): ID of the bucket to which the task belongs.\n- `plan_id` (str): ID of the plan to which the task belongs.\n- `access_token` (str): Access token for the Microsoft Graph API.\n- `group_id` (str): ID of the group to which the task belongs.\n\n**Returns:**\n- `str`: ID of the created task.\n\n**Example:**\n```python\nfrom msplanner_tools.tasks import create_task\nfrom msplanner_tools.auth import TokenManager\n\ntoken_manager = TokenManager(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id)\nitem_list = {\n \"title\": \"New Task\",\n \"assignments\": [\"owner@example.com\"],\n \"startDateTime\": \"2023-01-01T00:00:00Z\",\n \"dueDateTime\": \"2023-01-10T00:00:00Z\",\n \"priority\": 1,\n \"labels_list\": [\"category1\", \"category2\"]\n}\ntask_id = create_task(item_list, \"bucket_id\", \"plan_id\", token_manager.get_token(), \"group_id\")\nif task_id:\n print(\"Task successfully created!\")\n```\n\n#### `update_task_details`\n\nUpdates a task based on its ID, task data, ETag, and access token.\n\n**Parameters:**\n- `task_id` (str): ID of the task to be updated.\n- `item_list` (dict): Dictionary with the task data to be updated.\n- `etag` (str): ETag value of the task, obtained with the `get_task_etag` function.\n- `access_token` (str): Access token for the Microsoft Graph API.\n\n**Returns:**\n- `None`\n\n**Example:**\n```python\nfrom msplanner_tools.tasks import update_task_details\nfrom msplanner_tools.auth import TokenManager\n\ntoken_manager = TokenManager(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id)\nitem_list = {\n \"description\": \"Updated task description\",\n \"checklist\": [\"item1\", \"item2\"]\n}\netag = \"etag_value\"\nupdate_task_details(\"task_id\", item_list, etag, token_manager.get_token())\nprint(\"Task updated successfully.\")\n```\n\n## References\n\n- [MSAL Python Documentation](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-python)\n- [Microsoft Graph API Overview](https://docs.microsoft.com/en-us/graph/overview)\n\nNext, continue to [Buckets](buckets.md) for interacting with Microsoft Planner resources.\n\n---\n# Buckets\n\nThe `msplanner_tools.buckets` module provides functions to create, retrieve, and delete buckets in Microsoft Planner via the Microsoft Graph API.\n<br>\n[Return to the top](#authentication)\n\n### Functions Overview\n\n#### `create_bucket`\n\nCreates a new bucket in Microsoft Planner.\n\n**Parameters:**\n- `bucket_name` (str): Name of the bucket to be created.\n- `plan_id` (str): ID of the plan to which the bucket belongs.\n- `access_token` (str): Access token for the Microsoft Graph API.\n- `bucket_num` (int): Number of the bucket to be created (starts at 0).\n\n**Returns:**\n- `str`: ID of the created bucket.\n\n**Example:**\n```python\nfrom msplanner_tools.buckets import create_bucket\nfrom msplanner_tools.auth import TokenManager\n\ntoken_manager = TokenManager(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id)\nbucket_id = create_bucket(\"New Bucket\", \"plan_id\", token_manager.get_token(), 0)\nif bucket_id:\n print(\"Bucket successfully created!\")\n```\n\n#### `delete_bucket_by_id`\n\nDeletes a bucket based on its ID.\n\n**Parameters:**\n- `bucket_id` (str): ID of the bucket to be deleted.\n- `access_token` (str): Access token for the Microsoft Graph API.\n\n**Returns:**\n- `None`\n\n**Example:**\n```python\nfrom msplanner_tools.buckets import delete_bucket_by_id\nfrom msplanner_tools.auth import TokenManager\n\ntoken_manager = TokenManager(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id)\ndelete_bucket_by_id(\"bucket_id\", token_manager.get_token())\nprint(\"Bucket deleted successfully.\")\n```\n\n## References\n\n- [MSAL Python Documentation](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-python)\n- [Microsoft Graph API Overview](https://docs.microsoft.com/en-us/graph/overview)\n---\n# Users\n\nThis section focuses on managing Microsoft Planner users using the functions provided in the `msplanner_tools.users` module.\n<br>\n[Return to the top](#authentication)\n\n## Users Management\n\nThe `msplanner_tools.users` module provides functions to retrieve user information from Microsoft Planner via the Microsoft Graph API.\n\n### Functions Overview\n\n#### `find_user_id_by_email`\nFinds a user ID based on their email address.\n\n**Parameters:**\n- `email` (str): Email address of the user.\n- `group_id` (str): ID of the group to which the user belongs.\n- `access_token` (str): Access token for the Microsoft Graph API.\n\n**Returns:**\n- `str`: ID of the user.\n\n**Example:**\n```python\nfrom msplanner_tools.users import find_user_id_by_email\nfrom msplanner_tools.auth import TokenManager\n\ntoken_manager = TokenManager(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id)\nuser_id = find_user_id_by_email(\"user@example.com\", \"group_id\", token_manager.get_token())\nprint(f'User ID: {user_id}')\n```\n\n**References**\n- [MSAL Python Documentation](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-overview)\n- [Microsoft Graph API Overview](https://docs.microsoft.com/en-us/graph/overview)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Library to interact with Microsoft Planner via API Graph",
"version": "0.1.93",
"project_urls": {
"Documentation": "https://github.com/MigueldsBatista/msplanner-tools#readme",
"Homepage": "https://github.com/MigueldsBatista/msplanner-tools",
"Repository": "https://github.com/MigueldsBatista/msplanner-tools"
},
"split_keywords": [
"microsoft planner",
" api",
" graph",
" python",
" tasks",
" buckets",
" plans"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3bba55d2c0d03af0b6738a90dd61066699a1a30b9280b3994e9d7c8c3cfef146",
"md5": "97bd39959a93e84ab144ec26e1f959c9",
"sha256": "ee643819b3cafe490b41dd9989318ce66dad5258185991f0f0121607adb26413"
},
"downloads": -1,
"filename": "msplanner_tools-0.1.93-py3-none-any.whl",
"has_sig": false,
"md5_digest": "97bd39959a93e84ab144ec26e1f959c9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 12212,
"upload_time": "2024-12-01T02:18:58",
"upload_time_iso_8601": "2024-12-01T02:18:58.010613Z",
"url": "https://files.pythonhosted.org/packages/3b/ba/55d2c0d03af0b6738a90dd61066699a1a30b9280b3994e9d7c8c3cfef146/msplanner_tools-0.1.93-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "20cfc03df437a961e00aeee64023d765f6b8141f1e628cc01bdbd3865efd665e",
"md5": "4085d5ade295c3f726b47f2a32b6f7ff",
"sha256": "be16fccd14c1fb4430a08a1de4e92292135b7db5132138afc879cd175b9a9c9f"
},
"downloads": -1,
"filename": "msplanner-tools-0.1.93.tar.gz",
"has_sig": false,
"md5_digest": "4085d5ade295c3f726b47f2a32b6f7ff",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 12183,
"upload_time": "2024-12-01T02:19:21",
"upload_time_iso_8601": "2024-12-01T02:19:21.036073Z",
"url": "https://files.pythonhosted.org/packages/20/cf/c03df437a961e00aeee64023d765f6b8141f1e628cc01bdbd3865efd665e/msplanner-tools-0.1.93.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-01 02:19:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MigueldsBatista",
"github_project": "msplanner-tools",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "msplanner-tools"
}