Deep dive into office 365 api for one drive for business

28
Curso Desarrollo Office 365 Curso Desarrollo Office 365

Transcript of Deep dive into office 365 api for one drive for business

Curso Desarrollo Office 365Curso Desarrollo Office 365

Deep Dive into Office 365 APIsfor OneDrive for Business

Alberto Diaz Martin (@adiazcan)Principal Team Leader en ENCAMINAMVP de SharePoint Server

OverviewFile Operations with SharePointClientFile Operations with REST

Agenda

Overview

5

OneDrive for Business

A personal library for storing and organizing your work documents

6

OneDrive for Business Sharing

7

OneDrive for Business Sync

8

The Files APIhttps://[site]/_api/Files

File Operations with SharePointClient

10

Discovery Service discovers “MyFiles” capabilityReturns tenant and user-specific URL for user’s OneDrive for Business

SharePointClient.Files abstracts Files API

SharePointClient class

11

Read Files collection

Can also read an individual Folder

Both client and server paging supportedClient-side with LINQServer-side with $skiptoken

Reading File Metadata

12

Use AddAsync method

Provide a file name and the file stream

Uploading a new File

13

Get the target file using GetByAsync method

Delete using DeleteAsync method

Deleting a File

FILE OPERATIONS WITH THE SHAREPOINTCLIENT

demo

File Operations with REST

OneDrive for Business Files REST APIGet the metadata for all files in OneDrive

GET http://<onedrive>/_api/Files

Get the metadata for a folder in OneDriveGET http://<onedrive>/_api/Files('folder')

Get the metadata for the children of a folder in OneDriveGET http://<onedrive>/_api/Files('folder')/Children

Get the metadata for a single file in OneDriveGET http://<onedrive>/_api/Files('folder/filename.docx')

Download a single file from OneDriveGET http://<onedrive>/_api/Files('folder/filename.docx')/download

OneDrive for Business Files REST APIUpload a file to the specified path in OneDrive (pass file in body)

POST /_api/Files/Add(name='folder/filename.docx',overwrite=<bool>)

Delete a file from OneDriveDELETE /_api/Files('folder/filename.docx')

Get metadata for a folder and its childrenGET /_api/Files('folder')?$expand=Children

Get on selected metadata fields back for first 5 files in OneDriveGET /_api/Files?$select=Name,Id,TimeCreated,Size&$top=5

Use Files API on other document librariesGET /_api/Lists/GetByTitle('ListTitle')/Files

18

Use Discovery Service to get an Access Token

Obtaining an Access Token

19

GET Files endpoint

Paging is accomplished post-query using LINQ

Reading File Metadata

20

POST to Add endpoint

Provide a file name and the file stream

Uploading a new File

21

DELETE the target file ID

Deleting a File

FILE OPERATIONS WITH REST

demo

OverviewFile Operations with SharePointClientFile Operations with REST

Summary

Dev. .comOffice

One stop shop for Office Developer Platform

Explore our developer centerhttp://dev.office.com

Calls to action

Give feedback Drive our roadmap http://aka.ms/OfficeDevFeedback

Get answershttp://aka.ms/AskSharePointhttp://aka.ms/AskOffice

Play with our code sampleshttp://dev.office.com/code-samples

Jumpstart into our traininghttp://dev.office.com/training

Transform your codeProviding App Model Patterns for common Full Trust Code scenarios

60+ Visual Studio projectsCommon scenarios• Branding• Site provisioning• Remote event receivers • Large file support• Taxonomy driven navigation• And much more…

ContributeOpen source coming soon!

aka.ms/OfficeDevPnP

DeveloperPatterns & Practices

Microsoft Virtual Academy courses

2014

Aug Sept Oct

Introduction to Office 365 Development

2015

JanNov Dec

Deep Dive into the Office 365 App Model

Deep Dive into integrating Office 365 APIs with your standalone web application development

Deep Dive into integrating Office 365 APIs with your mobile device development

Shipping your Office 365 App to theOffice Store

Deep dive into the building blocks and services of the SharePoint platform

Feb

Deep Dive into Office 365 Development on non-Microsoft Stack

© 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.