Skip to main content

A Python Client Application that allows interaction with the Microsoft Graph API.

Project description

Microsoft Graph Python Client Library

Table of Contents


Microsoft Graph is the gateway to data and intelligence in Microsoft 365. It provides a unified programmability model that you can use to access the tremendous amount of data in Microsoft 365, Windows 10, and Enterprise Mobility + Security. This project utilizes python to help users interact with and manage data on Microsoft Graph API.


Setup - Requirements Install:

For this particular project, you only need to install the dependencies, to use the project. The dependencies are listed in the requirements.txt file and can be installed by running the following command:

pip install -r requirements.txt

After running that command, the dependencies should be installed.

Setup - Local Install:

If you are planning to make modifications to this project or you would like to access it before it has been indexed on PyPi. I would recommend you either install this project in editable mode or do a local install. For those of you, who want to make modifications to this project. I would recommend you install the library in editable mode.

If you want to install the library in editable mode, make sure to run the file, so you can install any dependencies you may need. To run the file, run the following command in your terminal.

pip install -e .

If you don't plan to make any modifications to the project but still want to use it across your different projects, then do a local install.

pip install .

This will install all the dependencies listed in the file. Once done you can use the library wherever you want.

Setup - PyPi Install:

To install the library, run the following command from the terminal.

pip install

Setup - PyPi Upgrade:

To upgrade the library, run the following command from the terminal.

pip install --upgrade


Here is a simple example of using the ms_graph library.

from pprint import pprint
from ms_graph.client import MicrosoftGraphClient
from configparser import ConfigParser

# Specify your scopes when you want access certain resources.
scopes = [

# Initialize the Parser.
config = ConfigParser()

# Read the file.'config/config.ini')

# Get the specified credentials.
client_id = config.get('graph_api', 'client_id')
client_secret = config.get('graph_api', 'client_secret')
redirect_uri = config.get('graph_api', 'redirect_uri')

# Initialize the Client.
graph_client = MicrosoftGraphClient(

# Login to the Client.

# Grab the User Services.
user_services = graph_client.users()

# List the Users.

# Grab the Drive Services.
drive_services = graph_client.drives()

# List the Root Drive.

Support These Projects

Patreon: Help support this project and future projects by donating to my Patreon Page. I'm always looking to add more content for individuals like yourself, unfortuantely some of the APIs I would require me to pay monthly fees.

YouTube: If you'd like to watch more of my content, feel free to visit my YouTube channel Sigma Coding.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ms-graph-python-client-0.1.0.tar.gz (22.5 kB view hashes)

Uploaded Source

Built Distribution

ms_graph_python_client-0.1.0-py3-none-any.whl (29.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page