![Page 1: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/1.jpg)
08 | Advanced Features
Jerry Nixon | Microsoft Developer EvangelistDaren May | President & Co-founder, Crank211
![Page 2: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/2.jpg)
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 xamlShow on CodePlex
http://xaml.codeplex.com
![Page 3: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/3.jpg)
Windows Live SDK Microsoft Account Using SkyDrive
Module Agenda
![Page 4: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/4.jpg)
Click to edit Master subtitle style
Microsoft Virtual Academy
Windows Live
![Page 5: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/5.jpg)
• 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:– SkyDrive– Outlook.com– Skype
Live SDK for Windows 8
![Page 6: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/6.jpg)
Click to edit Master subtitle style
Microsoft Virtual Academy
Microsoft Account
![Page 7: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/7.jpg)
• Microsoft account– Authentication– Personalization– Information– Scopes• wl.basic• wl.signin
• Guidelines– Sign-in state– Enable sign-out
Microsoft account
![Page 8: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/8.jpg)
DEMO
Microsoft Account
![Page 9: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/9.jpg)
Click to edit Master subtitle style
Microsoft Virtual Academy
SkyDrive
![Page 10: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/10.jpg)
• Microsoft’s cloud storage solution for files and photo sharing
• Guidelines for using SkyDrive in Windows 8 Apps– Upload data in response to user action• Apps are allowed to store data without user interaction
– Use SkyDrive for what it does best• Documents, photos, etc.
– Don’t undermine trust• Respect user security and privacy• Warn if data is public, etc.
SkyDrive overview
![Page 11: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/11.jpg)
• Don’t scatter data around SkyDrive
• Follow this pattern:– [SkyDrive root]• Sub folder: ApplicationData
– Sub folder: [Application Name] ([Publisher Name or Company Name])» Files…
Where to store app data in SkyDrive
![Page 12: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/12.jpg)
• 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:• LiveConnectClient.PostAsync• LiveConnectClient.GetAsync• Etc.
• Permissions– Inherited from parent object up the folder hierarchy
SkyDrive API Core Concepts
![Page 13: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/13.jpg)
• id - prefixed with file or folder– i.e. “file.a6b2a7e8f2515e5e.A6B2A7E8F2515E5E!126”
• name – user supplied display name– i.e. “EpisodeNotes.txt”
• description
• type – file, folder, album, etc.
• source – if a file, the path to download the file– https://....
Useful folder and file properties
![Page 14: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/14.jpg)
• Important types:– LiveConnectSession– LiveConnectClient• Requires a valid session• Required scope:
– wl.skydrive - Read access– wl.skydrive_update – read and write access
– LiveOperationResult• contains a dynamic dictionary containing resultant key/value pairs
Working with SkyDrive API
![Page 15: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/15.jpg)
• Supply the itemId as either an id or one of the few friendly names:• file.a6b2a7e8f2515e5e.A6B2A7E8F2515E5E!126
• /me/skydrive
Retrieving file or folder properties
![Page 16: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/16.jpg)
• Warning: no type safety or compiler checks!
Result properties can be access via dynamic
![Page 17: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/17.jpg)
• Some folders are accessed by Folder ID– Example: folder.a6b2a7e8f2515e5e.A6B2A7E8F2515E5E!
126
• Some folders are accessed by name– /me - details about the signed in user– /me/skydrive – root of your SkyDrive folder– /me/calendars– /me/contacts– /me/events
• List files by obtaining the containing folder id
Understanding folder and file hierarchy
![Page 18: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/18.jpg)
• Imagine we want to download filename.txt:– /me/skydrive/directory1/directory2/filename.txt
• In order to retrieve a list of files and folders contained in directory1 (and we don’t know directory1’s id), we first need to get a list of the folders in /me/skydrive
Download a file: Step 1 : Get folders of “/me/skydrive”
![Page 19: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/19.jpg)
• Once we have the list of files and folders (from /me/skydrive), we can find directory1 and its id property:
– id = folder.96a6fb5ab7b940c6.96A6FB5AB7B940C6!123
Download a file: Step 2 : Get “directory1” from list
![Page 20: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/20.jpg)
• We use the Folder Id to find the folders in directory1, so we can find the id for directory2:
Download a file: Step 3 : Get folders of “directory1”
![Page 21: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/21.jpg)
• We repeat the last few steps and get directory2’s id, – directory2Id =
folder.bb1b4E12b9f9414f.BB1B4E12B9F9414F!231
• We use can get a list of files (and folders) in directory2:
Download a file: Step 5 : Get files of “directory2”
![Page 22: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/22.jpg)
• We can the find the properties for filename.txt and the path we need to download it:
Download a file: Step 6 : Get “file.txt” file url
![Page 23: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/23.jpg)
• Now we have the download path, we need to create a local StorageFile where we will write the downloaded file
Download a file: Step 7 : Create local target
![Page 24: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/24.jpg)
• Use the download path
– Note: uses the background downloader
Download a file: Step 8 : Create local target
![Page 25: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/25.jpg)
1. Get folders of “/me/skydrive”
2. Get “directory1” from list
3. Get folders of “directory1”
4. Get “directory2” from list
5. Get files of “directory2”
6. Get “file.txt” file url
7. Create local target
8. Download to target
Get a file, recap
![Page 26: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/26.jpg)
DEMO
SkyDrive
![Page 27: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/27.jpg)
Windows Live ID SkyDrive
Module Review
![Page 28: 08 | Advanced Features Jerry Nixon | Microsoft Developer Evangelist Daren May | President & Co-founder, Crank211](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56649f055503460f94c1a56d/html5/thumbnails/28.jpg)
©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.