SlideShare una empresa de Scribd logo
1 de 36
DEEP DIVE INTO OFFICE 365 APIS FOR
SHAREPOINT SITE SERVICES
Bram de Jager
Technology Consultant | Macaw Workplace Solutions
Microsoft Certified Solutions Master: SharePoint
@bramdejager | bramdejager.wordpress.com
AGENDA
• Overview
• Get Started with Office 365 APIs
• File Operations with SharePointClient
• List Operations with REST
• Wrap-up
OVERVIEW
Deep Dive into Office 365 APIs for SharePoint Site services
API’S EVERYWHERE!
• SharePoint APIs
o .NET SSOM
o .NET CSOM
o JavaScript JSOM
o REST/OData endpoints
• Office 365 API
o Connect to your users' mail, calendars, contacts, and files into your app
• Microsoft Graph (previously known as Office 365 Unified API)
o Single endpoint for connecting to all of the Office 365 services
OFFICE 365API
SharePointExchange &
Outlook.com
OneDriveActive
Directory
Search
Sites, Lists
and Libs
Taxonomy
BCSWorkflow
…
MICROSOFT GRAPH
https://graph.microsoft.com/
WHY DO I NEED THE OFFICE 365APIS?
• Access Office 365 data outside of the Office 365 context
o But also integrate with the Office 365 and App Launcher
• Single set of APIs for (almost) all Office 365 services
• Uniform authentication, with support for
o Federation support (AD FS)
o Multi-Factor Authentication (MFA)
GET STARTED WITH OFFICE 365APIS
Deep Dive into Office 365 APIs for SharePoint Site services
DISCOVERY SERVICE
• Returns a collection of endpoints specific to current user
• Intended as the starting point for application
o 1. Sign-In
o 2. Get authorized
o 3. Discover endpoints for resource
o 4. Get Token
o 5. Access resource
• API Libraries simplify necessary code
• Capabilities: https://api.office.com/discovery/v1.0/me/allServices
AUTHENTICATION FLOW
Native Application
Azure AD Authorization
Endpoint
Azure AD Token
Endpoint
Office 365 API
Request authorization code
Return authorization code
Sign-in via browser (pop-up)
Redeem authorization code and acquire access token for Office 365 resource
Return access token and refresh token
Call Office 365 API using the access token
Return Http Response
ADAL
• Azure AD Authentication Library (ADAL) supports:
o Token Acquisition
o Token Cache storing access tokens and refresh tokens
o Automatic Token Refresh
o Asynchronous Methods
PERMISSIONS (CONNECTED SERVICE)
GRANTACCESS TO OFFICE 365
REVOKE CONSENT
• Navigate to https://portal.office.com/myapps
APP LAUNCHER INTEGRATION
DEMO
• Get started with Office 365 App development
o Register Office 365 App in Visual Studio
o Grant access (user consent)
o Implement ADAL for .NET
FILE OPERATIONS WITH SHAREPOINTCLIENT
Deep Dive into Office 365 APIs for SharePoint Site services
SHAREPOINT SITES SERVICES
• Provides access to SharePoint Online REST API
• SharePointClient class simplifies programming, but limited functionality
• Direct REST API calls more complex, but exposes more functionality
SHAREPOINTCLIENT CLASS
• Discovery Service discovers resource
• SharePointClient.Files abstracts Files API
https://api.office.com/discovery/v1.0/me/
https://api.office.com/discovery/
https://company.sharepoint.com/
GET FILES COLLECTION
• Get folders and files collection and read file metadata
• Get files in specific folder
• Type property is either “File” or “Folder”
BUTTHERE ISACATCH!
• The API searches for two document libraries, named
o (1) Shared Documents
o (2) Documents
• If libraries do not exist, then…
o {"error":{"code":"-2146232832,
Microsoft.SharePoint.SPException","message":"The file |0 does not exist."}}
DOCUMENT LIBRARIES DO NOT EXIST
DEMO
• Implement Get Files collection
• Scenario for the supported document libraries used by the Office 365 API for
Sites
o Site contains 3 document libraries, named: Shared Documents, Documents,
Other Documents
o Remove Shared Documents library
o Remove Documents library
ADD NEW FILE
• Use AddAsync() method
• Provide a file name and the file stream
DELETINGAFILE
• Get the file using GetById() method
• Delete using DeleteAsync() method
LIST OPERATIONS WITH REST
Deep Dive into Office 365 APIs for SharePoint Site services
READING LIST ITEMS
• Office 365 APIs do not support list operations
• Access the SharePoint REST API with the Access Token from the Office 365 API
GETACCESS TOKEN
DEMO
• Implement Reading List Items collection
• Use Office 365 API to retrieve Access Token
OTHER REST OPERATIONS
• List Items
o Adding a list item
o Updating a list item
o Deleting a list item
• Other REST APIs
o Taxonomy
o Search (Office Graph)
o BCS
o Workflow
o …
WRAP-UP
Deep Dive into Office 365 APIs for SharePoint Site services
KEY TAKEAWAY
• One API for accessing all Office 365 data
o API makes it easier, limited functionality
o Reuse the Access Token for REST calls
• Single repeatable pattern for
o Mail
o Contact
o Calendar
o Files
o OneDrive
o …
KEY TAKEAWAY
• Another approach to providing solutions
o Build a solution which connects to all Office 365 service
o App Launcher integration
o Use all capabilities provided by ASP.NET web application
o Integrate these Office 365 services into
o SharePoint Add-ins
o Office Add-ins
o Native apps: Windows Universal Apps, iOS, Android
RESOURCES
• Office Dev Center, http://dev.office.com
• Get started with Office 365 APIs, http://dev.office.com/getting-started/office365apis
• Office 365 API reference, https://msdn.microsoft.com/en-
us/office/office365/api/api-catalog
• Files REST API reference, https://msdn.microsoft.com/office/office365/APi/files-
rest-operations
• Authorization Code Grant Flow, https://msdn.microsoft.com/en-
us/library/azure/dn645542.aspx
• Kirk Evans Fiddler add-in (oAuth inspector),
http://blogs.msdn.com/b/kaevans/archive/2015/03/30/updated-fiddler-oauth-
inspector.aspx
SharePoint Client Browser
• Audience: Developer and IT Pro
• Insights into your Office 365 Tenant
and/or Site Collection
• Exposes the SharePoint CSOM
• Supports SharePoint Online and
SharePoint Server
• Just released new version
• Over 29.000 downloads already!
• http://spcb.codeplex.com
QUESTIONS?
Bram de Jager
@bramdejager | bramdejager.wordpress.com

Más contenido relacionado

Destacado

Как заработать в облаке? FAQ для реселлеров и интеграторов
Как заработать в облаке? FAQ для реселлеров и интеграторовКак заработать в облаке? FAQ для реселлеров и интеграторов
Как заработать в облаке? FAQ для реселлеров и интеграторовMichael Kozloff
 
The 3 Secrets of Highly Successful Graduates
The 3 Secrets of Highly Successful GraduatesThe 3 Secrets of Highly Successful Graduates
The 3 Secrets of Highly Successful GraduatesReid Hoffman
 
Himmelstein SP Connections HAD207 SharePoint Logging & Debugging
Himmelstein SP Connections HAD207 SharePoint Logging & DebuggingHimmelstein SP Connections HAD207 SharePoint Logging & Debugging
Himmelstein SP Connections HAD207 SharePoint Logging & DebuggingSentri
 
Common Data Service (CDS), a new database?
Common Data Service (CDS), a new database?Common Data Service (CDS), a new database?
Common Data Service (CDS), a new database?Pedro Azevedo
 
Andrea a alfabetización escaleta
Andrea a alfabetización escaletaAndrea a alfabetización escaleta
Andrea a alfabetización escaletaandrearanxa
 
The #1 Skill Every Marketer Needs to Have!
The  #1 Skill Every Marketer Needs to Have!The  #1 Skill Every Marketer Needs to Have!
The #1 Skill Every Marketer Needs to Have!Manpreet Jassal
 
Introduction to jenkins for the net developer
Introduction to jenkins for the net developerIntroduction to jenkins for the net developer
Introduction to jenkins for the net developerAbe Diaz
 
You've Made It - Pitching to TechCrunch & Using AngelList
You've Made It - Pitching to TechCrunch & Using AngelListYou've Made It - Pitching to TechCrunch & Using AngelList
You've Made It - Pitching to TechCrunch & Using AngelListRandy Ksar
 

Destacado (12)

Как заработать в облаке? FAQ для реселлеров и интеграторов
Как заработать в облаке? FAQ для реселлеров и интеграторовКак заработать в облаке? FAQ для реселлеров и интеграторов
Как заработать в облаке? FAQ для реселлеров и интеграторов
 
Arrival & departure
Arrival & departureArrival & departure
Arrival & departure
 
The 3 Secrets of Highly Successful Graduates
The 3 Secrets of Highly Successful GraduatesThe 3 Secrets of Highly Successful Graduates
The 3 Secrets of Highly Successful Graduates
 
Himmelstein SP Connections HAD207 SharePoint Logging & Debugging
Himmelstein SP Connections HAD207 SharePoint Logging & DebuggingHimmelstein SP Connections HAD207 SharePoint Logging & Debugging
Himmelstein SP Connections HAD207 SharePoint Logging & Debugging
 
Common Data Service (CDS), a new database?
Common Data Service (CDS), a new database?Common Data Service (CDS), a new database?
Common Data Service (CDS), a new database?
 
Andrea a alfabetización escaleta
Andrea a alfabetización escaletaAndrea a alfabetización escaleta
Andrea a alfabetización escaleta
 
The #1 Skill Every Marketer Needs to Have!
The  #1 Skill Every Marketer Needs to Have!The  #1 Skill Every Marketer Needs to Have!
The #1 Skill Every Marketer Needs to Have!
 
Cbhpm 5 edicao
Cbhpm 5 edicaoCbhpm 5 edicao
Cbhpm 5 edicao
 
E-ntrepreneur
E-ntrepreneurE-ntrepreneur
E-ntrepreneur
 
Introduction to jenkins for the net developer
Introduction to jenkins for the net developerIntroduction to jenkins for the net developer
Introduction to jenkins for the net developer
 
PowerApps Deep Dive
PowerApps Deep DivePowerApps Deep Dive
PowerApps Deep Dive
 
You've Made It - Pitching to TechCrunch & Using AngelList
You've Made It - Pitching to TechCrunch & Using AngelListYou've Made It - Pitching to TechCrunch & Using AngelList
You've Made It - Pitching to TechCrunch & Using AngelList
 

Último

AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 

Último (20)

AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 

Deep Dive into Office 365 APIs for SharePoint Site services

  • 1. DEEP DIVE INTO OFFICE 365 APIS FOR SHAREPOINT SITE SERVICES Bram de Jager Technology Consultant | Macaw Workplace Solutions Microsoft Certified Solutions Master: SharePoint @bramdejager | bramdejager.wordpress.com
  • 2. AGENDA • Overview • Get Started with Office 365 APIs • File Operations with SharePointClient • List Operations with REST • Wrap-up
  • 3. OVERVIEW Deep Dive into Office 365 APIs for SharePoint Site services
  • 4. API’S EVERYWHERE! • SharePoint APIs o .NET SSOM o .NET CSOM o JavaScript JSOM o REST/OData endpoints • Office 365 API o Connect to your users' mail, calendars, contacts, and files into your app • Microsoft Graph (previously known as Office 365 Unified API) o Single endpoint for connecting to all of the Office 365 services
  • 7. WHY DO I NEED THE OFFICE 365APIS? • Access Office 365 data outside of the Office 365 context o But also integrate with the Office 365 and App Launcher • Single set of APIs for (almost) all Office 365 services • Uniform authentication, with support for o Federation support (AD FS) o Multi-Factor Authentication (MFA)
  • 8. GET STARTED WITH OFFICE 365APIS Deep Dive into Office 365 APIs for SharePoint Site services
  • 9. DISCOVERY SERVICE • Returns a collection of endpoints specific to current user • Intended as the starting point for application o 1. Sign-In o 2. Get authorized o 3. Discover endpoints for resource o 4. Get Token o 5. Access resource • API Libraries simplify necessary code • Capabilities: https://api.office.com/discovery/v1.0/me/allServices
  • 10. AUTHENTICATION FLOW Native Application Azure AD Authorization Endpoint Azure AD Token Endpoint Office 365 API Request authorization code Return authorization code Sign-in via browser (pop-up) Redeem authorization code and acquire access token for Office 365 resource Return access token and refresh token Call Office 365 API using the access token Return Http Response
  • 11. ADAL • Azure AD Authentication Library (ADAL) supports: o Token Acquisition o Token Cache storing access tokens and refresh tokens o Automatic Token Refresh o Asynchronous Methods
  • 14. REVOKE CONSENT • Navigate to https://portal.office.com/myapps
  • 16. DEMO • Get started with Office 365 App development o Register Office 365 App in Visual Studio o Grant access (user consent) o Implement ADAL for .NET
  • 17. FILE OPERATIONS WITH SHAREPOINTCLIENT Deep Dive into Office 365 APIs for SharePoint Site services
  • 18. SHAREPOINT SITES SERVICES • Provides access to SharePoint Online REST API • SharePointClient class simplifies programming, but limited functionality • Direct REST API calls more complex, but exposes more functionality
  • 19. SHAREPOINTCLIENT CLASS • Discovery Service discovers resource • SharePointClient.Files abstracts Files API https://api.office.com/discovery/v1.0/me/ https://api.office.com/discovery/ https://company.sharepoint.com/
  • 20. GET FILES COLLECTION • Get folders and files collection and read file metadata • Get files in specific folder • Type property is either “File” or “Folder”
  • 21. BUTTHERE ISACATCH! • The API searches for two document libraries, named o (1) Shared Documents o (2) Documents • If libraries do not exist, then… o {"error":{"code":"-2146232832, Microsoft.SharePoint.SPException","message":"The file |0 does not exist."}}
  • 23. DEMO • Implement Get Files collection • Scenario for the supported document libraries used by the Office 365 API for Sites o Site contains 3 document libraries, named: Shared Documents, Documents, Other Documents o Remove Shared Documents library o Remove Documents library
  • 24. ADD NEW FILE • Use AddAsync() method • Provide a file name and the file stream
  • 25. DELETINGAFILE • Get the file using GetById() method • Delete using DeleteAsync() method
  • 26. LIST OPERATIONS WITH REST Deep Dive into Office 365 APIs for SharePoint Site services
  • 27. READING LIST ITEMS • Office 365 APIs do not support list operations • Access the SharePoint REST API with the Access Token from the Office 365 API
  • 29. DEMO • Implement Reading List Items collection • Use Office 365 API to retrieve Access Token
  • 30. OTHER REST OPERATIONS • List Items o Adding a list item o Updating a list item o Deleting a list item • Other REST APIs o Taxonomy o Search (Office Graph) o BCS o Workflow o …
  • 31. WRAP-UP Deep Dive into Office 365 APIs for SharePoint Site services
  • 32. KEY TAKEAWAY • One API for accessing all Office 365 data o API makes it easier, limited functionality o Reuse the Access Token for REST calls • Single repeatable pattern for o Mail o Contact o Calendar o Files o OneDrive o …
  • 33. KEY TAKEAWAY • Another approach to providing solutions o Build a solution which connects to all Office 365 service o App Launcher integration o Use all capabilities provided by ASP.NET web application o Integrate these Office 365 services into o SharePoint Add-ins o Office Add-ins o Native apps: Windows Universal Apps, iOS, Android
  • 34. RESOURCES • Office Dev Center, http://dev.office.com • Get started with Office 365 APIs, http://dev.office.com/getting-started/office365apis • Office 365 API reference, https://msdn.microsoft.com/en- us/office/office365/api/api-catalog • Files REST API reference, https://msdn.microsoft.com/office/office365/APi/files- rest-operations • Authorization Code Grant Flow, https://msdn.microsoft.com/en- us/library/azure/dn645542.aspx • Kirk Evans Fiddler add-in (oAuth inspector), http://blogs.msdn.com/b/kaevans/archive/2015/03/30/updated-fiddler-oauth- inspector.aspx
  • 35. SharePoint Client Browser • Audience: Developer and IT Pro • Insights into your Office 365 Tenant and/or Site Collection • Exposes the SharePoint CSOM • Supports SharePoint Online and SharePoint Server • Just released new version • Over 29.000 downloads already! • http://spcb.codeplex.com
  • 36. QUESTIONS? Bram de Jager @bramdejager | bramdejager.wordpress.com

Notas del editor

  1. Office 365 REST APIs let you plug in your users' mail, calendars, contacts, and files into your app. Office 365 REST API endpoint: Mail Contacts Calendars Outlook notifications (preview) Outlook user photo (preview) Discovery service Files OneDrive (preview) Video (preview) Office 365 Management APIs Service Communications API (preview) Management Activity API Reference (preview) Source: http://dev.office.com/getting-started/office365apis
  2. Single authentication and API endpoint for Office 365 and Microsoft Services, thus a single AccessToken for all services! Single endpoint, no discovery service required Require only 1 AccessToken Office 365 unified API endpoint Users Groups Files Mail Calendar Contacts and Office Graph Source: http://dev.office.com/unifiedAPIs
  3. Single auth flow for O365 Azure AD Graph, Exchange, SharePoint Device apps and web sites Admin and end-user consent Secure protocol OAuth 2.0 No capturing user credentials Fine-grained access scopes Supports MFA and federated user sign-in Long-term access through refresh tokens
  4. Authentication to Office 365 APIs using resource id Authorization Code Grant Flow The client application starts the flow by redirecting the user agent to the Azure AD authorization endpoint. The user authenticates and consents, if consent is required. The Azure AD authorization endpoint redirects the user agent back to the client application with an authorization code. The user agent returns authorization code to the client application’s redirect URI. The client application requests an access token from the Azure AD token issuance endpoint. It presents the authorization code to prove that the user has consented. The Azure AD token issuance endpoint returns an access token and a refresh token. The refresh token can be used to request additional access tokens. The client application uses the access token to authenticate to the Web API. After authenticating the client application, the web API returns the requested data. https://msdn.microsoft.com/en-us/library/azure/dn645542.aspx
  5. https://msdn.microsoft.com/en-us/library/azure/jj573266.aspx
  6. Grant access per person Grant access per organization
  7. How To Delete An App You Consented to in Azure AD https://samlman.wordpress.com/2015/02/27/how-to-delete-an-app-you-consented-to-in-azure-ad/
  8. Integrate Office 365 APIs into .NET Visual Studio projects https://msdn.microsoft.com/en-us/office/office365/howto/authenticate-and-use-services
  9. Paging is based on post-query using LINQ (left out)
  10. Office 365 API Sites Site with library named “Documents” or “Shared Documents” is only for OneDrive! Not for Files API
  11. Examples Macaw Colleague Sync Get all Macaw colleagues from Azure AD Retrieve user profile information from SharePoint via REST API by using the AccessToken Add every colleague to your personal Contacts Time registration Retrieve time information based on your personal Calendar Add entries to time registration tool based on calendar information Save a monthly report to your personal OneDrive Files Examples Macaw Colleague Sync Time registration