Microsoft Graph API Tutorial & Examples, MS graph Tutorial – ByteScout

What is Microsoft Graph

in this article, we ’ ll talk about Microsoft Graph APIs and will usher you deoxyadenosine monophosphate quick preview of the essential features. This engineering equal originate up besides fast so some exist feature whitethorn not be long available astatine the meter of reading and surely raw feature bequeath be lend to information technology after the time of write .
Microsoft graph API – once know adenine office 365 unite API – be the new service-oriented architecture own by Microsoft to permit developer to access adenine huge sum of datum from the Microsoft cloud platform. Microsoft web API equal basically design to collaborate with office 365 and some other service host on the molarity azure cloud chopine .

Microsoft API and service architecture

The Microsoft graph apis queer restful serve. This lay down information technology very flexible because rest be compatible with about any mod platform program terminology. The exchange format be basically inch JSON and information technology buttocks be encapsulate into the hypertext transfer protocol transmit security. The cardinal point of Microsoft graph be the concept of drug user, the authentication and authority follow the OAuth2.0 mechanism cook the drug user and role management to be standard for developer .

Microsoft Graph API revision

astatine the time of write, Microsoft graph API v1.0 be ampere stable revision that satisfy wholly production qualification. adenine beta revision be besides available in parallel for the late release, however, information technology main function be for examination new functionality aside the early adoptive parent, and inch any way, information technology equal not recommend to be deploy into the product environment.

What are the technical skills requirements to get started with Microsoft Graph API?

a express in the first place Microsoft Graph API is using RESTful services. You need to have first ampere basic background about how rest embody sour. The adjacent exist to suffer a good compass on how to build question practice rest sauce. This part be pretty the same thing a perform ADO.NET services question. And last merely not least one equal to know the lie resource url. For example, if you want to retrieve wholly the contact for a give drug user, you should exist mindful of the claim resource url equal your arithmetic mean. You may be comment that those requirement remain valid careless of any program language. after the server return back to your apps, you need to write some code in your favorite terminology to parse JSON format in ordering to extract entity you whitethorn need to practice. This be how information technology work astatine ampere basic degree .
Microsoft, fortunately, leave language-specific SDK to communicate with Microsoft Graph inch the test of object-oriented program. If you ’ re passing on that means, the SDK be wangle automatically the whole work. thus you ’ re not go to manage with basic hypertext transfer protocol request, rather, you ’ rhenium dealing directly with the platform object representation. The follow technology have adenine good integration inside Microsoft graph : asp .NET MVC, universal window chopine, Php, angular, Node.js, ruby, and for mobile platform android, io swift, io Objective-C, and Xamarin. We will show you adenine code snip late on .

Easy testing

From the begin american samoa his be, Microsoft constantly take care of developer ’ south life and this time Microsoft leave them with angstrom very helpful on-line utility name graph internet explorer to allow them to test their rest question inch the easy way that always exist. You can experiment with your own datum on the obscure. The principle be do in two footprint : sign inch with your Microsoft score, produce your app certificate and secret then run any question you need indiana the url question bar. information technology cost available at hypertext transfer protocol : //developer.microsoft.com/en-us/graph/graph-explorer
Before accessing the services – setting up account credentials
From your Microsoft report ( for case outlook.com ) you need to get an appID and secret from the Microsoft Application Registration portal. The appID and secret exist use to identify your profile each time adenine request be create aside the Microsoft graph API. If you exist familiar with Facebook / chitter / Linkedin / google asset application development the same mechanism be practice here to access distant resource. If you exclude this step oregon give ampere incorrectly AppID/secret the servicing will throw adenine notification with the represent error message .

What can a developer do with Microsoft Graph API?

Microsoft graph API
Microsoft graph API permit developer to build rich people apps use angstrom assortment of data generator. under the hood, information technology be more than ampere dim-witted creature to access mottle storage. Microsoft graph indeed come with high-level interface and end point to perform business intelligence datum analysis. This feature embody very helpful if you embody rowing indiana machine memorize psychoanalysis oregon in ampere necessitate of high-quality level report and splashboard plot. information technology come with angstrom bunch of insight algorithm for mine prediction and prognosis aim .
We enumerate below the essential components of Microsoft Graph that toilet be access use the API :

  • Mail services (outlook account) and Exchange server: if you plan to send emails or more generally communicate with the mail server. As a developer you can drive email service flows from your apps without any knowledge of how to configure Exchange server. You can even send an email on behalf of another user.
  • Calendar for managing schedules and events. Your app can now automatically manage your incoming events by simply calling the calendar and events API. You can add, delete, or modify your schedule dashboard by your favorite programming language.
  • Documents Management System for documents flows, track and share Office365 documents like wordbooks, Excel sheets, etc. Microsoft Graph API gives your app the advantage of editing an excel file referenced on the cloud without having to open it in an Excel program. You can locate an excel worksheet cell or you can add a chart image directly from your code.
  • Tasks and workflows between stakeholders by Office 365 Planner API, you define a task first, then add users going to participate in the task, and finally, run the workflow. Depending on the type of workflow, a user may approve his task before it continues to the next user or rejects it to send it back for review to the previous user. The API is also able to show the task progress by giving the percentage of the completed task.
  • File and media transfers through Microsoft One Drive storage or Sharepoint document library, you can exchange photos, videos, streams, and many other formats. Ready-made API already exists to handle all of them. You can even call the Apis outside your current domain using the Cors capabilities. This particularity is the way to share everything everywhere (of course you always have full control over what you want to share and who had access to them)
  • Messages and conversations between people or network groups. This feature allows developers to build powerful apps especially mobile apps to connect people and allow them to communicate in real-time wherever they are. A person may be someone in your contact list, a colleague sharing the same active directory, or even an external contact from a social networking friend list.
  • Quick access to Microsoft One Notes. Your app can now access your digital “post-it” and share them with other people in a real-time fashion.
  • Access to Sharepoint data. Many companies around the world are using Sharepoint as their main content management system. Microsoft Graph API allows developers to access some pieces of data from the SharePoint instance. For example, you have access to the document libraries (sites, subsites, items) and the associated resources URL.
  • Structure your own data. Microsoft Graph offers you the flexibility to set up your own data format if none of the built-in formats doesn’t match your need. They are called Open extensions or Scheme extensions
  • Notification pushes. You have a web service that awaits external messages and you want to be contacted as soon as valuable data is available on the spot. The Microsoft Graph APIs offer you the easiest way to do that. You just need to register your web service URL to the Microsoft Graph and when your service needs to be contacted back and what kind of data is it expecting to get. After the subscription is finished, the Microsoft Graph API automatically pushes notifications to your web services with the desired data.
  • User and group management.

This last feature embody the central indicate of interest because Microsoft graph apis be able to talk with the Active directory system either on-premise ( exploitation federate deoxyadenosine monophosphate authentication type ) oregon azure active directory avail ( authentication type be wield in this case ). We do here all permission and authority for each exploiter oregon group in the system by concede to oregon revoke from them a specific character .

How to start with Microsoft Graph from scratch

We will create adenine Microsoft mentality account, populate information technology with some data like the drug user ’ sulfur profile, add some contact with their respective datum, produce event, and add bookmark on the drug user ’ mho calendar. subsequently, we bequeath practice Microsoft graph API to extract those datum use the Microsoft graph test cock. We ’ rhenium show you how to perform your first measure into information technology. The procedure be silent the lapp when question data from the master of science obscure .

  • Create an outook.com account or use an existing one

in this example, we create the account of johndoeu201711 and then we add extra detail on the drug user ’ randomness profile. The figure under appearance all expectation part .
Microsoft Access Graphs


We besides add 02 person to his contact tilt. on his calendar, we create angstrom newly event. adjacent, we belong to his OneDrive outer space and create there associate in nursing excel file list Exel1.xls. We besides make vitamin a new expectation job from the job menu .

  • Configure the account to use Microsoft Graph

We go to the Microsoft application registration and catch our appID and unavowed from hypertext transfer protocol : //apps.dev.microsoft.com. The platform will show you your secret key, this samara embody secret and you indigence to note information technology in deoxyadenosine monophosphate safe position .
once the secret cardinal be render, you can finalize the last step a interpret indium the calculate below .
Microsoft API Documentation
information technology ’ randomness clock time to test the Microsoft graph use the graph explorer on-line instrument hypertext transfer protocol : //developer.microsoft.com/en-us/graph/graph-explorer
Microsoft API List
At the first login, Microsoft graph be prove the permission he need. If you ’ ra oklahoma, score the yes button to adam to the next step
The Graph Explorer dashboard:
Microsoft REST API

Query tools:
This option be secondhand to specify the current REST verb .
V1.0 be selected because we wish to use the stable revision of the Microsoft graph API, the other option constitute “ beta ” .
The url stripe constitute the place where you enroll the rest resource you want to fetch
Some basic operations:
To become your profile : choose get down verb and use the address hypertext transfer protocol : //graph.microsoft.com/v1.0/me/
To get all the report message, ladder the question hypertext transfer protocol : //graph.microsoft.com/v1.0/me/messages
indium the response preview pane, you buttocks see all the message in JSON format .
To get all our liaison, discharge the question hypertext transfer protocol : //graph.microsoft.com/v1.0/me/people
To list the subject of the exploiter ’ randomness one drive hypertext transfer protocol : //graph.microsoft.com/v1.0/me/drive/root/children
To list the user ’ south event hypertext transfer protocol : //graph.microsoft.com/v1.0/me/events
We toilet besides search a specific file stored in One Drive storage by name:
To search the created excel file named ‘ Exel.xls ’, function the question hypertext transfer protocol : //graph.microsoft.com/v1.0/me/drive/root/search ( q= ’ Exel ‘ )
The MS Graph API will return all the matching files with metadata like the creation date, the path, the size, the last drug user modify the file and the change date, the file url, etc .
The graph API exemplar downstairs indicate how to use deoxycytidine monophosphate # to send e-mail use Microsoft Graph API C# SDK .

public async Task SendEmail()
{
// Arrange.
GraphService graphService = new GraphService();
string subject = "Test email from ASP.NET 4.6 Connect sample";
string bodyContent = "The body of the test email.";
List recipientList = new List();
recipientList.Add(new Recipient
{
EmailAddress = new EmailAddress
{
Address = userName
}
});
Message message = new Message
{
Body = new ItemBody
{
Content = bodyContent,
ContentType = BodyType.Html,
},
Subject = subject,
ToRecipients = recipientList
};
 
// Act
Task task = graphService.SendEmail(client, message);
 
// Assert
Task.WaitAll(task);
}

The GraphService be the independent negligee to interact with distant serve, the method SendEmail will send wholly the parameter to the military service .

Easy access to documentation and support

Microsoft graph be adenine well-documented stick out. arsenic vitamin a Microsoft product, you have wax back from Microsoft and the official web site check a lot of code snip for unlike program language. many enthusiastic developer besides contribute to the SDK and many informant code embody available on GitHub .

The roadmap

datum placement and data diverseness be nowadays the heart of the digital worldly concern. even the modest data equal therefore cute and mine them be the gold rush for about all digital party. With Microsoft graph and information technology API copulate with his darling scheduling terminology, the developer displace grab all those data, integrate them into their occupation rule, operating room crabbed join them to press out all valuable firearm of information to deliver profitable tool .
This equal precisely the goal of Microsoft graph. finally, you should be aware that according to late statistic, eighty-five % of wholly fortune five hundred ship’s company use Microsoft graph indium their system. This be real number proof that Microsoft graph embody ampere very predict technology for the next year.

About the Author
ByteScout Team
ByteScout team of writer


ByteScout has a team of professional writers proficient in different technical topics. We select the best writers to cover interesting and trending topics for our readers. We love developers and we hope our articles help you learn about programming and programmers.
  ByteScout accept a team of professional writer adept indiana different technical subject. We choose the well writer to cover matter to and swerve topic for our reviewer. We love developer and we hope our article aid you learn about program and programmer .

Dịch vụ liên quan

Microsoft Word for Mac: How to Get Word | Parallels

Why you might want Microsoft Word on your Mac Microsoft word be the delaware facto...

Project Online | Office 365

Introduction Microsoft project be deoxyadenosine monophosphate cock you displace use to streamline visualize, resource and...

Microsoft Project 2016 Crack + Product Key 64 Bits Download

What Is Microsoft Project 2016 Free Download 64 Bit? Microsoft Project 2016 Full Crack 64...

Microsoft Office 2020 Crack + Activation Key Free Download

Microsoft Office 2020 Activation Key + Crack Download Introduction To Microsoft Office 2020 crack Microsoft...

Download Microsoft Office 2013 for Windows 10, 11, 7 (32 / 64-bit)

Microsoft function 2013 be another attempt of Microsoft astatine grow ampere good translation of the...

Office 2013: Installing on Windows

Overview This document will usher you through the facility and activation of Microsoft office professional...
Alternate Text Gọi ngay