08 Advanced Features Jerry Nixon Microsoft Developer Evangelist

  • Slides: 28
Download presentation
08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President

08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank 211

Agenda for the Day First Half Second Half 01 | Animations 05 | Advanced

Agenda for the Day First Half Second Half 01 | Animations 05 | Advanced Contracts Pt 1. 02 | Responsive Design 06 | Advanced Contracts Pt 2. 03 | Branding 07 | Media 04 | Reusable Controls 08 | Advanced Features ** MEAL BREAK ** Visit xaml. Show on Code. Plex http: //xaml. codeplex. com

Microsoft Virtual Academy Windows Live

Microsoft Virtual Academy Windows Live

Live SDK for Windows 8 • Uses OAuth 2. 0, JSON and REST APIs

Live SDK for Windows 8 • Uses OAuth 2. 0, JSON and REST APIs • Simplifies log in and token management • Provides shims & UI for interacting endpoints • The SDK provides access to: – Sky. Drive – Outlook. com – Skype

Microsoft Virtual Academy Microsoft Account

Microsoft Virtual Academy Microsoft Account

Microsoft account • Microsoft account – Authentication – Personalization – Information – Scopes •

Microsoft account • Microsoft account – Authentication – Personalization – Information – Scopes • wl. basic • wl. signin • Guidelines – Sign-in state – Enable sign-out

Microsoft Account

Microsoft Account

Microsoft Virtual Academy Sky. Drive

Microsoft Virtual Academy Sky. Drive

Sky. Drive overview • Microsoft’s cloud storage solution for files and photo sharing •

Sky. Drive overview • Microsoft’s cloud storage solution for files and photo sharing • Guidelines for using Sky. Drive in Windows 8 Apps – Upload data in response to user action • Apps are allowed to store data without user interaction – Use Sky. Drive for what it does best • Documents, photos, etc. – Don’t undermine trust • Respect user security and privacy • Warn if data is public, etc.

Where to store app data in Sky. Drive • Don’t scatter data around Sky.

Where to store app data in Sky. Drive • Don’t scatter data around Sky. Drive • Follow this pattern: – [Sky. Drive root] • Sub folder: Application. Data – Sub folder: [Application Name] ([Publisher Name or Company Name]) » Files…

Sky. Drive API Core Concepts • Interact with files using HTTP operations: – POST

Sky. Drive API Core Concepts • Interact with files using HTTP operations: – POST / PUT to upload – GET to download – MOVE / COPY to move or copy without downloading – The SDK wrappers these operations for you: • Live. Connect. Client. Post. Async • Live. Connect. Client. Get. Async • Etc. • Permissions – Inherited from parent object up the folder hierarchy

Useful folder and file properties • id - prefixed with file or folder –

Useful folder and file properties • id - prefixed with file or folder – i. e. “file. a 6 b 2 a 7 e 8 f 2515 e 5 e. A 6 B 2 A 7 E 8 F 2515 E 5 E!126” • name – user supplied display name – i. e. “Episode. Notes. txt” • description • type – file, folder, album, etc. • source – if a file, the path to download the file – https: //. .

Working with Sky. Drive API • Important types: – Live. Connect. Session – Live.

Working with Sky. Drive API • Important types: – Live. Connect. Session – Live. Connect. Client • Requires a valid session • Required scope: – wl. skydrive - Read access – wl. skydrive_update – read and write access – Live. Operation. Result • contains a dynamic dictionary containing resultant key/value pairs

Retrieving file or folder properties • Supply the item. Id as either an id

Retrieving file or folder properties • Supply the item. Id as either an id or one of the few friendly names: • file. a 6 b 2 a 7 e 8 f 2515 e 5 e. A 6 B 2 A 7 E 8 F 2515 E 5 E!126 • /me/skydrive

Result properties can be access via dynamic • Warning: no type safety or compiler

Result properties can be access via dynamic • Warning: no type safety or compiler checks!

Understanding folder and file hierarchy • Some folders are accessed by Folder ID –

Understanding folder and file hierarchy • Some folders are accessed by Folder ID – Example: folder. a 6 b 2 a 7 e 8 f 2515 e 5 e. A 6 B 2 A 7 E 8 F 2515 E 5 E!126 • Some folders are accessed by name – /me - details about the signed in user – /me/skydrive – root of your Sky. Drive folder – /me/calendars – /me/contacts – /me/events • List files by obtaining the containing folder id

Download a file: Step 1 : Get folders of “/me/skydrive” • Imagine we want

Download a file: Step 1 : Get folders of “/me/skydrive” • Imagine we want to download filename. txt: – /me/skydrive/directory 1/directory 2/filename. txt • In order to retrieve a list of files and folders contained in directory 1 (and we don’t know directory 1’s id), we first need to get a list of the folders in /me/skydrive

Download a file: Step 2 : Get “directory 1” from list • Once we

Download a file: Step 2 : Get “directory 1” from list • Once we have the list of files and folders (from /me/skydrive), we can find directory 1 and its id property: – id = folder. 96 a 6 fb 5 ab 7 b 940 c 6. 96 A 6 FB 5 AB 7 B 940 C 6!123

Download a file: Step 3 : Get folders of “directory 1” • We use

Download a file: Step 3 : Get folders of “directory 1” • We use the Folder Id to find the folders in directory 1, so we can find the id for directory 2:

Download a file: Step 5 : Get files of “directory 2” • We repeat

Download a file: Step 5 : Get files of “directory 2” • We repeat the last few steps and get directory 2’s id, – directory 2 Id = folder. bb 1 b 4 E 12 b 9 f 9414 f. BB 1 B 4 E 12 B 9 F 9414 F!231 • We use can get a list of files (and folders) in directory 2:

Download a file: Step 6 : Get “file. txt” file url • We can

Download a file: Step 6 : Get “file. txt” file url • We can the find the properties for filename. txt and the path we need to download it:

Download a file: Step 7 : Create local target • Now we have the

Download a file: Step 7 : Create local target • Now we have the download path, we need to create a local Storage. File where we will write the downloaded file

Download a file: Step 8 : Create local target • Use the download path

Download a file: Step 8 : Create local target • Use the download path – Note: uses the background downloader

Get a file, recap 1. Get folders of “/me/skydrive” 2. Get “directory 1” from

Get a file, recap 1. Get folders of “/me/skydrive” 2. Get “directory 1” from list 3. Get folders of “directory 1” 4. Get “directory 2” from list 5. Get files of “directory 2” 6. Get “file. txt” file url 7. Create local target 8. Download to target

Sky. Drive

Sky. Drive

© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics

© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics 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.