350 likes | 363 Views
Learn how to develop solutions with OneDrive and OneDrive for Business, including how to integrate with the OneDrive API, use pickers and savers, and leverage features like webhooks.
E N D
Developing solutions with OneDrive and OneDrive for Business Ryan Gregg, Principal Program Manager Daron Spektor, Principal Engineering Manager 3-734
Developer vision USERS DATA HTML
Agenda What is OneDrive? Developer Platform Overview Pickers and Savers OneDrive API Webhooks Demos along the way
What is OneDrive? • Securely store your files and folders and access them from anywhere. • Synchronize files across all your devices. • Powerful search capabilities let you quickly and easily find your files. • Deeply integrated with Office. • Collaborate with others on any device. • Available for personal or business scenarios. • One place for everything in your life / work.
OneDrive and Windows 10 • OneDrive on Windows 10 works differently than Windows 8.1. • Selective sync model means some files will be cloud-only. • Building OneDrive into your app should go beyond file system level access. • Windows comes with OneDrive to keep all your files in the cloud so you can access them from any device.
Which to use? • OneDrive • Accessible cloud storage for personal documents, photos, and files that can be accessed from anywhere. • Best for user owned content. • OneDrive for Business • Secure enterprise grade storage for business documents and files. • Best for business / enterprise owned content. • Depending on your app targeting both is appropriate.
Why use OneDrive as a platform? • Connecting your app to where the files are enables new scenarios for your app. • OneDrive has a huge range of people storing files in our cloud. • We’re the backend for Microsoft apps and enable great scenarios: Office for iPad, cloud attachments in Outlook. • OneDrive can provide value to your app when you store user files and documents there. • Use OneDrive as a backend to build killer cloud experiences.
Platform choices • Pickers and savers for quick integrations. • Quickly open files from OneDrive and save files back. • Supported for JavaScript, iOS, Android, and Windows Universal apps. • OneDrive API for deeper / robust integrations. • Rich web API that enables all integrations with OneDrive. • First party applications built on this. • Two pathways to light up OneDrive<->app integration
Pickers and savers • Quick way to enable the simplest scenario to open or save to OneDrive. • Multi-platform support: Windows, iOS, Android, Web. • Few lines of code and you’re good to go. • Quickly open and save to OneDrive from your application.
Open from OneDrive - JS <script type="text/javascript" src="https://js.live.net/v5.0/OneDrive.js" id="onedrive-js" client-id="APP_ID"></script> <script type="text/javascript"> window.onload = function() { varpickerOptions = { success: function(files) { // Handle returned file object(s) }, cancel: function() { // Handle when the user cancels }, linkType: "webViewLink", } varpickerButton = OneDrive.createOpenButton(pickerOptions); document.appendChild(pickerButton); } </script>
OneDrive API • Clean, intuitive REST API for OneDrive. • Works the way you want to • Use paths when convenient: \Contoso\ProjectA\Guidelines.dox • Use IDs when you need persistence: F0A198012908190 • Rich in functionality • Get a delta of changes to files and folders since your last call • Application folder to give your app a place to keep content • Upload large files (up to 10 GB) • CORS support so you can use it from JavaScript • OAuth 2 authentication • OData v4.0 compatible • $metadata provides description of entities, functions, and actions. • For deeper scenarios that simple open and save. • This API is powering the future of OneDrive and Office 365 experiences for files.
Navigating Items Your Way • /drive/root:/Contoso/ProjectA:/children • /drive/items/F0A1291828!101/children • /drive/items/F0A..19:/document1.docx • /drive/items/F0A..19/thumbnails/0/large • Use the colon to denote a path within the drive. • Combine ID and Path • Address entities on items
Sync Changes • Callable on any folder, not just the root. • Based on a sync token, returns items changed since token was generated. • Deleted items are returned with ‘deleted’ property. • Moving an item out of the hierarchy will make you resync. • Find out what changed without polling every folder.
App Folders • Keep your app files in a known location. • No need to create folders. • Restricted access to only your folder makes your app more trustworthy. • A home for content created in your app
Large Files • /upload.createSession • Provide the details of the file you are uploading. • PUT fragments until complete • Create and upload requests with sequential fragments of the file until the whole file is uploaded. • When the last fragment is received, the file is added to the user’s OneDrive. • Upload up to 10 GB using this method. • If the file is available on the internet, use Upload From URL instead.
Cross-origin Resource Sharing • Cross-origin Resource Sharing enables script to call OneDrive API from any domain • Full API is available, download, upload, and manage files. • Use OneDrive API directly from a single-page JavaScript app.
App Permission Scopes • No permissions – Use picker/saver • onedrive.readonly • Read-only access to everything in the user’s OneDrive. • onedrive.readwrite • Read-write access to everything in the user’s OneDrive. • onedrive.appfolder • Read-write access to your app folder in the user’s OneDrive. • Use the least-permissive permission scope possible. • For many scenarios, appfolder is sufficient.
Something New: OneDrive for Business • In preview, but available today on your SharePoint tenant. • Reduced functionality – we’re still building this. • We expect to drop new functionality monthly. • Updates will be posted on dev.onedrive.com • One API for OneDrive, business or personal. • Write your connection to OneDrive once and have it work with OneDrive and OneDrive for Business with the same code.
OneDrive API for OneDrive for Business • Key differences • Authentication: Need to target AAD or MSA depending on user type. Auth scopes are different as a result • Discovery: OneDrive for Business doesn’t have a common API end point, so discovery API is still necessary • Similarities • Once your app has an access token, code should be the same (see release notes for full details).
OneDrive for Business – What’s Coming • Create and manage sharing links • View changes / sync • Thumbnails • Upload large files • Search • We’re listening to your feedback via UserVoice • Keeping our API release notes up to date: • aka.ms/odb-api-release-notes
Something new: Webhooks for OneDrive • We have a lot of traffic polling OneDrive for changes. • Sync changes has reduced this to 1 call per user vs. 1 call / user / folder. • Webhooks enable apps to be efficient about their call patterns. • Poke/pull model ensures you don’t miss a change. • OneDrive tells your service when something interesting happens.
Webhooks – how it works • Register a URL for your service w/ OneDrive. • User connects your app with OneDrive. • User adds/edits/deletes a file or folder. • OneDrive POSTs to your URL that a change occurred for that user.
Webhooks • Preview available in the next few weeks for OneDrive. • Coming later this summer for OneDrive for Business. • Watch dev.onedrive.com for more details.
Documentation: We want to be the best • We want to have the best docs. • We test our documentation with every change to ensure it’s valid. • Our docs are open source on GitHub • We accept pull requests. • If they aren’t great, let us know (or fix them!) Build Passing
Takeaway • Build great app experiences by connecting to where the content is – and it’s in the cloud. We’re doing everything to make OneDrive and Office 365 be that place. • Connecting to OneDrive is easy and super fast. • We’re on a journey to keep making this better, come along with us and provide feedback!
Takeaway • Now: OneDrive API for OneDrive for Business (preview) • Soon: Webhooks for OneDrive • Later: Webhooks for OneDrive for Business
Call to Action • OneDrive powers cloud experiences from Microsoft, use it to power yours as well. • Starting building great cloud apps with OneDrive API today. • Find more information at dev.onedrive.com. • We love feedback - we monitor Stack Overflow, GitHub, and UserVoice for feedback and to prioritize future work. Join our community!
Developer Program Launch http://dev.office.com/devprogram 1 YEAR FREE E-mail Newsletters Free Developer Subscription Free Training Free Tools Webinars
Call to action Collect your stickers at //build Check out the express talks Sign up for Developer Program