Accessing Office 365 / Microsoft Cloud Data on SharePoint Using Graph API – Part One

Introduction

Let us look at accessing Office 365 and Microsoft Cloud Services data, using Graph REST API calls. In this article, you will get an  introduction to Graph API and the steps for registering a new app.

Microsoft Graph exposes Office 365 and other Microsoft Cloud Services data like Outlook mail, Outlook calendar, One drive, tasks, groups, SharePoint, etc. through a single endpoint URL (https://graph.microsoft.com).

Graph API

The pattern for Microsoft Graph API requests will be https://graph.microsoft.com/{version}/{resource}?[query_parameters].

Version can be v1.0 (latest) or beta. Resources denote the access groups (it can be me or the users or the groups).

Accessing the resources over graph data should be through proper authentication mechanisms. There are multiple ways to connect to Graph APIs, using various development platforms. Here, let us see how the graph data can be accessed with REST APIs. To access the data through Microsoft graph, the users should authenticate their identity to perform any actions.

Register Application

Access the graph apps portal https://apps.dev.microsoft.com/.

  
  • Click Register an app button.
  • Sign in with your Microsoft Online account.
  • Navigate to my Applications and add new app.
  • In the app details page,

    • Provide the app name.
    • Generate new key pair and save the password securely.
    • Add the appropriate platform (Web for our case).
    • Add the required delegated permissions. Select all the read operations.
    • Click Save.

From the Applications page, copy the App ID, which will be used in Rest API call operations.

 

Permissions Scope

The app permissions can be changed any time. Access the app and add or remove the permissions, whenever required. In this case, delegated permission scope is chosen. Delegated permission scope is for running the apps on behalf of the user, which delegates the logged in user permissions. The permission scope details are listed in Microsoft developer site https://developer.microsoft.com/en-us/graph/docs/authorization/permission_scopes.
 

App Manifest File

App Manifest file shows the entire app details. All the configured values like title, App ID, created time, credentials, selected scope details are present in the file. It can be changed directly on the app. 

Summary

Thus, you have seen a basic introduction and registering the app for the authorizations. In the next articles, you will see how to access Office 365 and Microsoft Cloud data, using the Graph API on SharePoint.

Up Next
    Ebook Download
    View all
    Learn
    View all