girliemac / mslearn-retrieve-m365-data-with-msgraph-quickstart

Quick start sample using JavaScript to retrieve M365 data using Microsoft Graph

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A JavaScript application to retrieve Microsoft 365 data using Microsoft Graph 🚀

Prerequisites

Register Azure AD APP

You have to register an application in Azure Active Directory in order to run this application. You could do it manually in the Azure Portal.

Register AAD app Manually in Azure Portal

  1. Register a new application in the Azure Portal.
  2. Ensure that the application is enabled for the authorization code flow with PKCE. This will require that you redirect URI configured in the portal is of type SPA.
  3. For this sample we will create a single tenant application

Configure the sample

  1. Copy the value of the Application (client) ID of the newly registered application from Azure Portal. You can get this from the overview page of the newly registered application.
  2. In the auth.js file, on line 4, replace the value of the clientId property with the copied Application (client) ID
  3. Copying the value of the Directory (tenant) ID of the newly registered application from Azure Portal. You can get this from the overview page of the newly registered application.
  4. In the auth.js file, on line 6, replace the value of the authority property with the Directory (tenant) ID copied in above step, eg https://login.microsoftonline.com/0be187e2-aa5c-464a-bc8b-74b0416b4c3a, since this is a single tenant application.
  5. In case you created a multi-tenant application then comment out line 6 in auth.js. You don't need to pass the authority.

Run the app

  • In the command line, go to the project root folder mslearn-retrieve-m365-data-with-msgraph-quickstart.
  • Run below script in the command line. This will open your application in the browser with the url http://localhost:8080.
npm start

If the configuration of the app is successful, the app will be as shown below:

Working app

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Legal Notices

Microsoft and any contributors grant you a license to the Microsoft documentation and other content in this repository under the Creative Commons Attribution 4.0 International Public License, see the LICENSE file, and grant you a license to any code in the repository under the MIT License, see the LICENSE-CODE file.

Microsoft, Windows, Microsoft Azure and/or other Microsoft products and services referenced in the documentation may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries. The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks. Microsoft's general trademark guidelines can be found at http://go.microsoft.com/fwlink/?LinkID=254653.

Privacy information can be found at https://privacy.microsoft.com/en-us/

Microsoft and any contributors reserve all other rights, whether under their respective copyrights, patents, or trademarks, whether by implication, estoppel or otherwise.

About

Quick start sample using JavaScript to retrieve M365 data using Microsoft Graph

License:Creative Commons Attribution 4.0 International


Languages

Language:JavaScript 73.8%Language:HTML 26.2%