Create Top WordPress Plugin – Microsoft Graph Education API 101

Are you looking for methods to create a WordPress Plugin or Theme for the Microsoft Graph Education API? Then you have landed at the right place! Read ahead and know the most detailed process for the right management system for your educational purposes. Microsoft Graph Education API upgrades Office 365 resources with Azure AD for School Data Sync (SDS) management that is important for educational institutions data about classes, Students, Teachers, assignments, and submissions.

WordPress Plugin Features for Microsoft Graph Education API

WordPress plugin can be easily developed for Microsoft Graph Education API that will not only be customizable but also easy to understand. It will give a platform for professional institutions to develop websites more easily with the following features:

  • Azure Active Directory Application
  • Install Microsoft Graph SDK for PHP
  • Authorization
  • Schools
  • Classes
  • Assignments
  • Users

Azure Active Directory Application

You will be required to register an application at the Azure portal by Microsoft Graph Education API. The application would also require permission for Microsoft Graph Education API calls. To create an Application, you will have to log in to the Azure portal. After the login, you will see Azure Active Directory Section—once you click on it there will be App registrations at the left menu. By clicking on the App registrations menu link, it will give the option to manage and create new applications. By clicking on the new registration link you will get a registration form. By adding application name, supported account types, and application Redirect URI, click on register.

Once you create the application, you need to copy Application (client) ID,  Directory (tenant) ID, Object ID that will be used for authorization.

Now click on API permissions from the left menu. You need to add application permissions for Microsoft Graph Education API as you can see in the reference.

By clicking on the Certificates & secrets tab from the left menu, you will create a new client secret.

Once you create the client secret, make sure you copy that client’s secret value as it will appear again due to security reasons.

Install Microsoft Graph SDK for PHP

Microsoft Graph Education API SDK will be installed in the plugin directory by using the composer or using composer.json.

composer require microsoft/microsoft-graph.


OAuth 2.0 Client library will be used to get authorization. You can install via composer with following command:

Or you can add the following in you composer.json file:

We have installed the Microsoft Graph and Oauth2 Client and now it needs to include our plugin.

To get an access token for Microsoft Graph Education API you can use this URL for authorization.

First, define your application credentials via constants in your WordPress plugin.

By using PHP oauth2 client auth URL, create as following:

You need to set the Application (client) ID with the scope that will define which type of permissions are required.

You will get a response with a code that will be used to get the access token.

Token Request

By using authorization code you will send a request for Access Token that will be used for Microsoft Graph Education API calls with the following parameters:

Here is a PHP oauth2 client script that will be used to get access token. After sending a token request you will get a successful token response like mentioned below:

Refresh Token Request
  • If the token is generated with expired time

When the token expires, it doesn’t require to send a request again but a request will be sent for a ‘refresh token’. Token Expired time will be stored in the session that will be used to check if it’s expired. in such case, a request for refresh token with the following script will be sent:

Microsoft Graph Education API-User Data AP

We have done application authentication with an access token, now it’s time to call Microsoft Graph Education API to get user data by using the access token.

Microsoft Graph Calendar API

Microsoft Graph Education API provides options to create/list calendars, get the calendar, create/ list events. For calendar API permissions, “Calendars.ReadWrite” must be added in the application authentication scope.

Create Calendar

By using Microsoft Graph API, Calendars can be created.

Calendar Listing

Calendars will be listed with the following script:

Create Event

Calendar Event will be created as follow:

Events Listing

Calendar events will be listed by using a calendar ID with the GET method, with the following code.

Microsoft Graph Education API

Microsoft Graph provides an education API with following features:

  • Schools
  • Classes
  • User(Students/Teachers)
  • Assignment
  • Category
  • Assignment Submission


Microsoft Graph Education API uses the EducationSchool class to create, update, and list schools.

Create Schools

To Create School requests, sent in json format with POST method.


Microsoft Graph Education API uses an EducationClass object that will be used to create and list classes.

Classes Listing

EducationClass objects will be used to list classes with the the GET method.


There will be assignments for each class which will be created by the teacher or the team owner. Assignments will be assigned to the user. It will be in the draft state once created which needs to publish action to change its status. This functionality will be available in the beta version of Microsoft Graph Education API.

Classes Assignment

EducationAssignment object will be used to create assignments with json data in the request body with the POST method.

Publish Assignment

By default, the Assignments will be in draft state. Teachers need to publish assignments to make them available to students. It doesn’t require any request body and it returns with a “204 No Content” response.

Assignment Listing

EducationAssignment object will be used for assignment listing with the GET method.

Assignment Categories Listing

EducationCategory  object will be used for assignment categories listing with the GET method.

Assignment Submission Listing

EducationSubmission object will be used for the user assignment submissions listing with the GET method.

Create Assignment Submission Resource

Students will submit an assignment field to which it is assigned.   assignmentEducationSubmissionResource object will be used for user assignment submissions listing with the GET method.


Teachers or Students can list their schools, classes, and rubrics by using Microsoft Graph Education API.

School Listing

EducationSchool objects will be used for the user’s schools listing with the GET method.

Classes Listing

EducationClass object will be used for the user’s classes listed with the GET method.


Rubrics Listing

EducationRubric objects will be used for user classes listing with the GET method.

With this detailed explanation of Microsoft Graph Education API, you can build LMS according to your requirements by using the code snippet mentioned in the detail above.

If you need any help or assistance in creating the WordPress Plugin for Microsoft Graph Education API or if you require a tailored solution, please feel free to get connected to our team at vteams and leave the rest to us.

User Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

    Get in Touch