Crates.io | msgraph-rs |
lib.rs | msgraph-rs |
version | 0.1.2 |
source | src |
created_at | 2024-09-14 09:58:18.125338 |
updated_at | 2024-09-14 15:47:04.861586 |
description | A Rust library for interacting with Microsoft Graph API |
homepage | |
repository | https://github.com/whitefox82/msgraph-rs |
max_upload_size | |
id | 1374646 |
size | 96,734 |
msgraph-rs
is a Rust library for interacting with the Microsoft Graph API. It provides an easy-to-use interface for authenticating and making requests to Microsoft Graph endpoints, allowing you to manage users, groups, emails, and more within Azure Active Directory.
To use this library in your Rust project, add the following to your Cargo.toml
:
[dependencies]
msgraph-rs = "0.1.1"
or
cargo add msgraph-rs
To authenticate, you'll need to provide your Microsoft Azure app credentials (client ID, client secret, and tenant ID). These credentials allow you to interact with Microsoft Graph APIs securely.
You can find these values in the Azure portal by navigating to Azure Active Directory > App registrations and selecting your app.
The following example demonstrates how to obtain an access token and output it to the terminal.
User.Read.All
User.Read
These permissions allow the app to read user profiles in the directory and authenticate.
The following example demonstrates how to list users in your Azure Active Directory tenant using the msgraph-rs
library.
User.Read.All
User.ReadBasic.All
These permissions allow the app to read the basic profile information of all users in the directory. User.Read.All
allows broader access, while User.ReadBasic.All
allows access to minimal profile information (like display name and email).
This example shows how to retrieve a specific user by their userPrincipalName
(typically their email) or user_id
.
User.Read.All
User.Read
These permissions allow the app to retrieve detailed profile information for a specific user in the directory.
This example shows how to revoke a specific users sign in sessions by their userPrincipalName
(typically their email) or user_id
.
Directory.ReadWrite.All
User.ReadWrite
These permissions allow the app to read and revoke a user’s sign-in sessions in the directory.
This example demonstrates how to send an email using the Microsoft Graph API. You will need to provide the sender's userPrincipalName
(typically their email) and the email body including the recipient's email address, subject, and content.
These permissions allow the app to send emails on behalf of the authenticated user.