GraphAPI
The GraphAPI class is a Python wrapper for interacting with the Microsoft Graph API, providing simplified access to Microsoft services such as Office 365, OneDrive, and Outlook. It abstracts away the complexity of authentication and API calls, allowing developers to easily perform actions like retrieving user information, accessing email messages, uploading and downloading files, creating folders, and more.
Features
- Authenticate with Microsoft Azure Active Directory.
- Retrieve user information and email messages.
- Upload and download files to/from OneDrive.
- Create and manage folders in OneDrive.
- Search for files.
- Delete files and folders.
- Generate share links for files.
- Access advanced functionality of the Microsoft Graph API.
Installation
- Clone or download the repository.
- Install the required dependencies using
pip install -r requirements.txt.
- Import the
GraphAPI class into your Python project.
Getting Started
- Create an instance of the
GraphAPI class with your Azure AD app credentials and user ID.
- Use the provided methods to interact with the Microsoft Graph API and perform desired actions.
- Refer to the code documentation and examples for detailed usage instructions.
from graphapi import GraphAPI
api = GraphAPI(appid, client_secret, tenant_id, userid)
api.get_information()
mail = api.get_mail()
api.upload_to_onedrive('file.txt', '/path/to/folder', access_token)
api.download_file('file.txt', '/path/to/folder', 'destination.txt')
api.create_folder('new_folder')
search_results = api.search_for_file('keyword')
api.delete_file('file.txt', '/path/to/folder')
share_link = api.create_share_link('file.txt', '/path/to/folder')
download_by_filename('foo.txt')
Contributing
Contributions are welcome!
License
This project is licensed under the MIT License.