Skip to main content

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

  1. Clone or download the repository.
  2. Install the required dependencies using pip install -r requirements.txt.
  3. Import the GraphAPI class into your Python project.

Getting Started

  1. Create an instance of the GraphAPI class with your Azure AD app credentials and user ID.
  2. Use the provided methods to interact with the Microsoft Graph API and perform desired actions.
  3. Refer to the code documentation and examples for detailed usage instructions.
from graphapi import GraphAPI

# Create an instance of the GraphAPI class
api = GraphAPI(appid, client_secret, tenant_id, userid)

# Retrieve user information
api.get_information()

# Access email messages
mail = api.get_mail()

# Upload a file to OneDrive
api.upload_to_onedrive('file.txt', '/path/to/folder', access_token)

# Download a file from OneDrive
api.download_file('file.txt', '/path/to/folder', 'destination.txt')

# Create a folder in OneDrive
api.create_folder('new_folder')

# Search for files
search_results = api.search_for_file('keyword')

# Delete a file or folder
api.delete_file('file.txt', '/path/to/folder')

# Generate a share link for a file
share_link = api.create_share_link('file.txt', '/path/to/folder')

# Download Filename from OneDrive
download_by_filename('foo.txt')

Contributing

Contributions are welcome!

License

This project is licensed under the MIT License.

Release files for MicrosoftGraphAPI 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for MicrosoftGraphAPI 0.0.3
File Size Uploaded
MicrosoftGraphAPI-0.0.3.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for MicrosoftGraphAPI 0.0.3
File Interpreter ABI Platform
MicrosoftGraphAPI-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 11.4 kB

Release files / MicrosoftGraphAPI-0.0.3.tar.gz

Download URL MicrosoftGraphAPI-0.0.3.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
18a53db39f1fae313dbdbfa52b65283c907d7b4666c0d80d3d81af4f31c00a6e
BLAKE2b-256 checksum
How to use checksums
969dd630a6ac5b0a3208e494e289b90782f3d48fc66af9f55eb5f5c081a0a1e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.17

Release files / MicrosoftGraphAPI-0.0.3-py3-none-any.whl

Download URL MicrosoftGraphAPI-0.0.3-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6cc83ed94cd64175ecf1677d1ea2fb4a9420447866b10e47116f5c4c67d7d008
BLAKE2b-256 checksum
How to use checksums
d9b3df5982b5bbb96ddef4b46dd0bfab34dadb1324733da662a677a5cbf98ec9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.17

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page