Getting started with the Microsoft Graph Toolkit
You can watch this short video to see how quick and easy it is to get started with the Toolkit.
For a step-by-step tutorial, see the Get started with Microsoft Graph Toolkit module.
Set up your Microsoft 365 tenant
In order to develop with the Toolkit, you need access to a Microsoft 365 tenant. If you don't have one, you can get a free Microsoft 365 developer subscription by joining the Microsoft 365 Developer Program. For details about how to configure your subscription, see Set up a Microsoft 365 developer subscription.
Set up your development environment
To develop with the Toolkit, you will need a text editor or IDE. You can use the editor or IDE of your choice or install and use Visual Studio Code for free. You will also need a modern web browser like Microsoft Edge, Google Chrome, or Firefox. You'll also need an LTS version of Node.js, which you can install from nodejs.org.
Using the Microsoft Graph Toolkit
You can use the Microsoft Graph Toolkit in your application by referencing the loader directly (via unpkg) or by installing the npm package.
To use the Toolkit via mgt-loader, add the reference in a script to your code:
<script src="https://unpkg.com/@microsoft/mgt/dist/bundle/mgt-loader.js"></script> <mgt-msal2-provider client-id="<YOUR_CLIENT_ID>"></mgt-msal2-provider> <mgt-login></mgt-login>
The Microsoft Graph Toolkit is made up of several NPM packages, allowing you to only include the code you need for your applications.
@microsoft/mgt-element is the core package that contains only the base classes used for building components and providers. This package exposes all necessary classes and interfaces needed to build your own components and exports the IProvider interface and SimpleProvider class for building custom providers.
@microsoft/mgt-components package contains all Microsoft Graph connected web components, such as
PeoplePicker, and more.
Providers are available via a single package and can be installed as needed. The following provider packages are available:
mgt-msal-providercomponent. The MSAL provider uses msal.js for authenticating in web apps and Progressive Web Apps (PWAs).
mgt-msal2-providercomponent. The MSAL2 provider uses msal-browser for authenticating in web apps and PWAs.
mgt-teams-providercomponent. The Microsoft Teams provider enables authentication in Microsoft Teams tab application.
mgt-teams-msal2-providercomponent. The Microsoft Teams MSAL2 provider enables authentication in Microsoft Teams tab application.
SharePointProviderfor authenticating in a SharePoint environment.
ProxyProviderfor application that proxy Graph calls through a backend service.
@microsoft/mgt is the main package that includes all above packages and re-exports them so they are available via a single package you can install.
@microsoft/mgt-react package contains all auto-generated React components and takes dependency on the
@microsoft/mgt-spfx package contains a SharePoint Framework library that's required to use Microsoft Graph Toolkit in SharePoint Framework solutions.
You're now ready to start developing with the Microsoft Graph Toolkit! The following guides are available to help you get started: