SlideShare a Scribd company logo
Partner: Veranstalter:
Introducing SDKs for Microsoft Graph
Dragan Panjkov
Dragan Panjkov
Microsoft MVP – Office Servers and Services
Consultant at K2 NE (www.k2.com)
Website and blog: www.dragan-panjkov.com
Twitter: @panjkov
 Microsoft Graph API
 Microsoft Graph SDK for .NET
 Microsoft Graph SDK for JavaScript
 A unique set of API to rule all the services
 Unified endpoint
 Unique handshake and Access Token
 Unique development experience
 Unique consumption model: REST
Calendar
Office Graph
https://graph.microsoft.com
Search
Social
Mail PeopleDocuments
Designed for
openness and
flexibility
Enabling a
consistent
development
platform
Powering
a world
of devices
iOS
dev.office.com
Groups Notebooks Videos
/{version}/{tenant} /{entity-set} /{id}/{property}
Demo
Playing with the Microsoft Graph API
TASKS
manager
memberOf
FILES
MESSAGES
workingWith
Shared with me
directReports
createdBy
FILES
CONVERSATIONS
createdBy
workingWith
EVENTS
trendingAround
GROUPS
TASKS
NOTES
NOTES
public
modifiedBy
USER
trendingAround
SPKonferenz 2017 - Introducing SDKs for Microsoft Graph
 Open Source SDK
 Available for .NET and many other platforms
 Mainly auto-generated with VIPR
 Based on the $metadata descriptors
 Open Authentication Model
 Mainly supported: ADAL and MSAL
 Asynchronous by design (async/await)
 Install the NuGet package (Microsoft.Graph)
 Register your application
 Azure Active Directory
 https://manage.windowsazure.com/ or https://portal.azure.com/
 Application Registration Portal (for V2 Authentication Endpoint - Preview)
 https://apps.dev.microsoft.com/
 Prepare the authentication code/model
 Pass it to the constructor of the GraphServiceClient type
 GO!
Demo
“Hello World!” Microsoft Graph SDK
 There are auto-generated RequestBuilder types
 Implement interfaces like I*RequestBuilder
 They provide Request() method
 Which provides chain of OData querying methods
 Invoke GetAsync() method to execute request
 Replicates OData behavior and signatures
 Select() => $select
 Filter() => $filter
 OrderBy() => $orderby
 Expand() => $expand
 Provides paging capabilities
 Through NextPageRequest property on query results/collections
Demo
Request and Query Model
 Collections provide methods to manage resources
 AddAsync() => POST
 UpdateAsync() => PATCH
 PutAsync() => PUT
 DeleteAsync() => DELETE
 Reference exception type ServiceException
 Useful properties
 Error (Code, Message, InnerError, AdditionalData, etc.)
 IsMatch() method for fine handling of errors
SPKonferenz 2017 - Introducing SDKs for Microsoft Graph
Node
npm install @microsoft/microsoft-graph-client
const MicrosoftGraph = require("@microsoft/microsoft-graph-
client");
Browser
<script type="text/javascript" src="graph-js-sdk-web.js"></script>
var client = MicrosoftGraph.Client.init({
authProvider: (done) => {
done(null, "PassInAccessTokenHere"); //first parameter takes an error
if you can't get an access token
}
});
// get the names of my top 5 contacts on the beta endpoint
client
.api('me/people')
.version("beta") //optional, but recommeded to have before query params
.top(5)
.select("displayName")
.get((err, res) => {
const topContacts = res.value.map((u) => {return u.displayName});
console.log("Your top contacts are", topContacts.join(", "));
});
client
.api('/me/people')
.select(["displayName", "department", "title"])
.get((err, res) => {
console.log(res)
})
// construct the email object
const mail = {
subject: "Microsoft Graph JavaScript Sample",
toRecipients: [{
emailAddress: {
address: "example@example.com"
}
}],
body: {
content: "<h1>MicrosoftGraph JavaScript Sample</h1>Check out
https://github.com/microsoftgraph/msgraph-sdk-javascript",
contentType: "html"
}
}
client
.api('/users/me/sendMail')
.post({message: mail}, (err, res) => {
console.log(res)
})
// delete a OneDrive item
client
.api(´/me/drive/items/${ONE_DRIVE_FILE_ID_TO_DELETE}`)
.delete((err, res) => {
if (err) {
console.log(err)
return;
}
console.log(res)
})
var file = document.querySelector('input[type=file]').files[0];
client
.api('/me/photo/$value')
.put(file, (err, res) => {
if (err) {
console.log(err);
return;
}
console.log("We've updated your picture!");
});
// Upload a file to OneDrive
let fs = require('fs'); // requires filesystem module
let stream = fs.createReadStream('./logo.png'); //path to local
file
client
.api('/me/drive/root/children/logo.png/content') // path to
the destination in OneDrive
.put(stream, (err) => {
console.log(err);
});
const fs = require('fs'); // requires filesystem module
client
.api('/me/drive/root/children/Book.xlsx/content') // path
of source file in OneDrive
.getStream((err, downloadStream) => {
let writeStream = fs.createWriteStream('Book.xlsx'); //
path to save file to
downloadStream.pipe(writeStream).on('error',
console.log);
});
Demo
JavaScriptSDK samples
Resources
https://developer.microsoft.com/en-us/graph/
https://channel9.msdn.com/blogs/OfficeDevPnP/PnP-Web-
Cast-Introduction-to-Microsoft-Graph-NET-SDK
https://github.com/microsoftgraph/msgraph-sdk-dotnet
https://github.com/microsoftgraph/msgraph-sdk-javascript
https://github.com/microsoftgraph/angular-connect-sample
https://github.com/microsoftgraph/nodejs-connect-sample
FRAGEN?
Ich freue mich auf Ihr Feedback!
Partner: Veranstalter:
Vielen Dank!
Dragan Panjkov

More Related Content

What's hot (20)

PPTX
Custom HTML5-Native Bridge for Android
mhant
 
PPT
ASP.NET 4.0 Roadmap
Harish Ranganathan
 
PPT
Introduction to Vaadin
Jeroen Benats
 
PDF
Vaadin 7.2
Joonas Lehtinen
 
PPTX
SharePoint Development with the SharePoint Framework
JoAnna Cheshire
 
PDF
Hybrid apps - Your own mini Cordova
Ayman Mahfouz
 
PPTX
Groovy in SOAP UI
ravireddy76
 
PPT
You Know WebOS
360|Conferences
 
PDF
Introduction to azure web applications for office and share point developers
JoAnna Cheshire
 
PDF
Vaadin & Web Components
Joonas Lehtinen
 
PPT
Developing a Better User Experience with "Atlas"
goodfriday
 
PDF
MongoDB.local Berlin: App development in a Serverless World
MongoDB
 
PDF
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
MongoDB
 
PPTX
Integrating SharePoint 2010 and Visual Studio Lightswitch
Rob Windsor
 
PPT
Asp.net mvc
Phuc Le Cong
 
PDF
Html5 - Awesome APIs
Dragos Ionita
 
PPTX
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
SharePoint Saturday NY
 
KEY
SharePoint 2010 Client Object Model
G. Scott Singleton
 
PDF
Connecting Google API's With Mule ESB
Jitendra Bafna
 
PPTX
European SharePoint Conference 2018 - Build an intelligent application by con...
Sébastien Levert
 
Custom HTML5-Native Bridge for Android
mhant
 
ASP.NET 4.0 Roadmap
Harish Ranganathan
 
Introduction to Vaadin
Jeroen Benats
 
Vaadin 7.2
Joonas Lehtinen
 
SharePoint Development with the SharePoint Framework
JoAnna Cheshire
 
Hybrid apps - Your own mini Cordova
Ayman Mahfouz
 
Groovy in SOAP UI
ravireddy76
 
You Know WebOS
360|Conferences
 
Introduction to azure web applications for office and share point developers
JoAnna Cheshire
 
Vaadin & Web Components
Joonas Lehtinen
 
Developing a Better User Experience with "Atlas"
goodfriday
 
MongoDB.local Berlin: App development in a Serverless World
MongoDB
 
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
MongoDB
 
Integrating SharePoint 2010 and Visual Studio Lightswitch
Rob Windsor
 
Asp.net mvc
Phuc Le Cong
 
Html5 - Awesome APIs
Dragos Ionita
 
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
SharePoint Saturday NY
 
SharePoint 2010 Client Object Model
G. Scott Singleton
 
Connecting Google API's With Mule ESB
Jitendra Bafna
 
European SharePoint Conference 2018 - Build an intelligent application by con...
Sébastien Levert
 

Similar to SPKonferenz 2017 - Introducing SDKs for Microsoft Graph (20)

PPTX
SharePoint Saturday Chicago - Everything your need to know about the Microsof...
Sébastien Levert
 
PPTX
An introduction to Microsoft Graph for developers
Microsoft 365 Developer
 
PPTX
SharePoint Conference 2018 - Build an intelligent application by connecting i...
Sébastien Levert
 
PDF
Microsoft graph and power platform champ
Kumton Suttiraksiri
 
PDF
Xamarin microsoft graph
Nicolò Carandini
 
PPTX
Building a chat app with windows azure mobile
Flavius-Radu Demian
 
PDF
Create cross-platform apps that interact with Microsoft Graph and Office 365 ...
Codemotion
 
PPTX
SharePoint for the .NET Developer
John Calvert
 
PDF
Prisma the ORM that node was waiting for
Commit University
 
PPTX
2008 - TechDays PT: Building Software + Services with Volta
Daniel Fisher
 
PDF
Apache Samza 1.0 - What's New, What's Next
Prateek Maheshwari
 
PDF
O365Con18 - Reach for the Cloud Build Solutions with the Power of Microsoft G...
NCCOMMS
 
PPT
Whidbey old
grenaud
 
PPT
ASPNET for PHP Developers
Wes Yanaga
 
PPTX
Soaring through the Clouds - Oracle Fusion Middleware Partner Forum 2016
Lucas Jellema
 
PPTX
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!
Sébastien Levert
 
PPTX
APIs, APIs Everywhere!
BIWUG
 
PPTX
Create the Modern Workplace with the SharePoint Framework
SharePoint Patterns and Practices
 
PDF
App engine devfest_mexico_10
Chris Schalk
 
PPTX
ECS 19 - Chris O'Brien - The hit list - Office 365 dev techniques you should ...
European Collaboration Summit
 
SharePoint Saturday Chicago - Everything your need to know about the Microsof...
Sébastien Levert
 
An introduction to Microsoft Graph for developers
Microsoft 365 Developer
 
SharePoint Conference 2018 - Build an intelligent application by connecting i...
Sébastien Levert
 
Microsoft graph and power platform champ
Kumton Suttiraksiri
 
Xamarin microsoft graph
Nicolò Carandini
 
Building a chat app with windows azure mobile
Flavius-Radu Demian
 
Create cross-platform apps that interact with Microsoft Graph and Office 365 ...
Codemotion
 
SharePoint for the .NET Developer
John Calvert
 
Prisma the ORM that node was waiting for
Commit University
 
2008 - TechDays PT: Building Software + Services with Volta
Daniel Fisher
 
Apache Samza 1.0 - What's New, What's Next
Prateek Maheshwari
 
O365Con18 - Reach for the Cloud Build Solutions with the Power of Microsoft G...
NCCOMMS
 
Whidbey old
grenaud
 
ASPNET for PHP Developers
Wes Yanaga
 
Soaring through the Clouds - Oracle Fusion Middleware Partner Forum 2016
Lucas Jellema
 
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!
Sébastien Levert
 
APIs, APIs Everywhere!
BIWUG
 
Create the Modern Workplace with the SharePoint Framework
SharePoint Patterns and Practices
 
App engine devfest_mexico_10
Chris Schalk
 
ECS 19 - Chris O'Brien - The hit list - Office 365 dev techniques you should ...
European Collaboration Summit
 
Ad

More from Dragan Panjkov (20)

PDF
NetWork9-Pretvorite svoju poslovnu aplikaciju u Teams Tab u tri jednostavna k...
Dragan Panjkov
 
PDF
Developing with SharePoint Framework (SPFx) on-premises
Dragan Panjkov
 
PDF
Building serverless applications with Microsoft Graph and Azure Functions
Dragan Panjkov
 
PDF
Building serverless applications with Microsoft Graph and Azure Functions
Dragan Panjkov
 
PDF
How to create custom connector for Microsoft Flow
Dragan Panjkov
 
PDF
Developing with SharePoint Framework (SPFx) on-premises
Dragan Panjkov
 
PDF
How to create custom Connector for Microsoft Flow
Dragan Panjkov
 
PDF
Building serverless applications with Microsoft Graph and Azure Functions - S...
Dragan Panjkov
 
PDF
How to create custom connector for Microsoft Flow - SPSNL18
Dragan Panjkov
 
PDF
Building Serverless Applications with Microsoft Graph - ECS 2018
Dragan Panjkov
 
PDF
How to: Create a custom connector for Microsoft Flow
Dragan Panjkov
 
PDF
Microsoft Graph and Azure Functions - SharePoint User Group Frankfurt
Dragan Panjkov
 
PPTX
ATD 13 - Enhancing your applications using Microsoft Graph API
Dragan Panjkov
 
PPTX
SPS Vienna 2017 - Getting started with APIs for Groups and Planner
Dragan Panjkov
 
PPTX
SPS Lisbon 2017 - Enhancing your applications using Microsoft Graph API
Dragan Panjkov
 
PPTX
SPKonferenz 2017 - Planning with Planner
Dragan Panjkov
 
PPTX
MSNetWork 7 - Microsoft Teams Extensibility - bots, connectors, tabs
Dragan Panjkov
 
PPTX
MSNetWork 7 - Implementacija SharePoint 2016 farme na Azure IAAS
Dragan Panjkov
 
PPTX
Planning with Planner - SPS Lisbon 2016
Dragan Panjkov
 
PPTX
Office Command Add-ins – New generation of Add-ins
Dragan Panjkov
 
NetWork9-Pretvorite svoju poslovnu aplikaciju u Teams Tab u tri jednostavna k...
Dragan Panjkov
 
Developing with SharePoint Framework (SPFx) on-premises
Dragan Panjkov
 
Building serverless applications with Microsoft Graph and Azure Functions
Dragan Panjkov
 
Building serverless applications with Microsoft Graph and Azure Functions
Dragan Panjkov
 
How to create custom connector for Microsoft Flow
Dragan Panjkov
 
Developing with SharePoint Framework (SPFx) on-premises
Dragan Panjkov
 
How to create custom Connector for Microsoft Flow
Dragan Panjkov
 
Building serverless applications with Microsoft Graph and Azure Functions - S...
Dragan Panjkov
 
How to create custom connector for Microsoft Flow - SPSNL18
Dragan Panjkov
 
Building Serverless Applications with Microsoft Graph - ECS 2018
Dragan Panjkov
 
How to: Create a custom connector for Microsoft Flow
Dragan Panjkov
 
Microsoft Graph and Azure Functions - SharePoint User Group Frankfurt
Dragan Panjkov
 
ATD 13 - Enhancing your applications using Microsoft Graph API
Dragan Panjkov
 
SPS Vienna 2017 - Getting started with APIs for Groups and Planner
Dragan Panjkov
 
SPS Lisbon 2017 - Enhancing your applications using Microsoft Graph API
Dragan Panjkov
 
SPKonferenz 2017 - Planning with Planner
Dragan Panjkov
 
MSNetWork 7 - Microsoft Teams Extensibility - bots, connectors, tabs
Dragan Panjkov
 
MSNetWork 7 - Implementacija SharePoint 2016 farme na Azure IAAS
Dragan Panjkov
 
Planning with Planner - SPS Lisbon 2016
Dragan Panjkov
 
Office Command Add-ins – New generation of Add-ins
Dragan Panjkov
 
Ad

Recently uploaded (20)

PPTX
EO4EU Ocean Monitoring: Maritime Weather Routing Optimsation Use Case
EO4EU
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
PDF
Continouous failure - Why do we make our lives hard?
Papp Krisztián
 
PDF
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PPTX
Cubase Pro Crack 2025 – Free Download Full Version with Activation Key
HyperPc soft
 
PDF
Laboratory Workflows Digitalized and live in 90 days with Scifeon´s SAPPA P...
info969686
 
PPTX
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
PPTX
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
PPTX
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
PDF
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
PPTX
Human Resources Information System (HRIS)
Amity University, Patna
 
PPTX
computer forensics encase emager app exp6 1.pptx
ssuser343e92
 
PDF
interacting-with-ai-2023---module-2---session-3---handout.pdf
cniclsh1
 
PPTX
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
PPTX
Quality on Autopilot: Scaling Testing in Uyuni
Oscar Barrios Torrero
 
PDF
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 
PPT
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
PPTX
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
EO4EU Ocean Monitoring: Maritime Weather Routing Optimsation Use Case
EO4EU
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
Continouous failure - Why do we make our lives hard?
Papp Krisztián
 
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
Cubase Pro Crack 2025 – Free Download Full Version with Activation Key
HyperPc soft
 
Laboratory Workflows Digitalized and live in 90 days with Scifeon´s SAPPA P...
info969686
 
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
Human Resources Information System (HRIS)
Amity University, Patna
 
computer forensics encase emager app exp6 1.pptx
ssuser343e92
 
interacting-with-ai-2023---module-2---session-3---handout.pdf
cniclsh1
 
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
Quality on Autopilot: Scaling Testing in Uyuni
Oscar Barrios Torrero
 
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 

SPKonferenz 2017 - Introducing SDKs for Microsoft Graph

Editor's Notes

  • #8: $metadata OAuth authentication flow overview Consuming the API using Fiddler
  • #29: $metadata OAuth authentication flow overview Consuming the API using Fiddler