BRK3342: Building Office 365 Apps with Xamarin

[Speaker: Chakkaradeep Chinnakonda Chandran, James Montemagno] The demand for mobile applications in the workplace has sky rocketed, especially when it comes to integrating with systems that business users consume in their day to day work life. This session will introduce the different approaches to building mobile applications that consumes Office 365 platform services. The session will give an overview of both native Windows and Xamarin cross-platform development (Android, iOS, Windows Phone) using Visual Studio.

Deep DiveBreakoutIgnite2015XamarinOffice 365
1.0x

BRK3342: Building Office 365 Apps with Xamarin

Created 2 years ago

Duration 1:14:30
lesson view count 209
[Speaker: Chakkaradeep Chinnakonda Chandran, James Montemagno] The demand for mobile applications in the workplace has sky rocketed, especially when it comes to integrating with systems that business users consume in their day to day work life. This session will introduce the different approaches to building mobile applications that consumes Office 365 platform services. The session will give an overview of both native Windows and Xamarin cross-platform development (Android, iOS, Windows Phone) using Visual Studio.
Select the file type you wish to download
Slide Content
  1. Building Multi-Device Appswith Xamarin and Office 365 APIs

    Slide 1 - Building Multi-Device Appswith Xamarin and Office 365 APIs

    • Chakkaradeep (Chaks) Chandran
    • Program Manager, Microsoft
    • James Montemagno
    • Developer Evangelist, Xamarin
    • BRK3342
  2. Xamarin Overview

    Slide 2 - Xamarin Overview

    • Connecting to Office 365
    • Authenticating Users
    • Access Office 365 APIs
    • Building iOS, Android, and Windows Apps in C#
    • Agenda
  3. Who’s this guy?

    Slide 3 - Who’s this guy?

    • James
    • Montemagno
    • Developer Evangelist, Xamarin
    • james@xamarin.com http://motzcod.es/ @JamesMontemagno
  4. Who’s Chaks?

    Slide 4 - Who’s Chaks?

    • Chakkaradeep (Chaks)
    • Chandran
    • Program Manager,
    • Office 365 NextGen Portals
    • chaksc@Microsoft.com @chakkaradeep www.chakkaradeep.com
  5. Scheduling Meetings Should Be Easy

    Slide 5 - Scheduling Meetings Should Be Easy

  6. Cross Platform

    Slide 6 - Cross Platform

    • Integrate with My Team
    • Schedule with a few clicks
    • Schedule Easily
  7. Introducing

    Slide 7 - Introducing

    • 5 Minute Meeting
  8. Slide 8

    • Architecting Mobile Apps
  9. Native User Interfaces

    Slide 9 - Native User Interfaces

    • Native API Access
    • Native Performance
  10. Xamarin’s Unique Approach

    Slide 10 - Xamarin’s Unique Approach

    • Shared C# codebase • 100% native API access • High performance
    • iOS C# UI
    • Windows C# UI
    • Android C# UI
    • Shared C# Backend
  11. Xamarin’s Unique Approach

    Slide 11 - Xamarin’s Unique Approach

    • Shared C# codebase • 100% native API access • High performance
    • iOS C# UI
    • Windows C# UI
    • Android C# UI
    • Shared C# Backend
  12. How Xamarin Works

    Slide 12 - How Xamarin Works

  13. Windows APIs

    Slide 13 - Windows APIs

    • Microsoft.Phone
    • Microsoft.Networking
    • Windows.Storage
    • Windows.Foundation
    • Microsoft.Devices
    • System.Data
    • System.Windows
    • System.Numerics
    • System.Core
    • System.ServiceModel
    • System.Net
    • System
    • System.IO
    • System.Linq
    • System.Xml
  14. iOS – 100% API Coverage

    Slide 14 - iOS – 100% API Coverage

    • MapKit
    • UIKit
    • iBeacon
    • CoreGraphics
    • CoreMotion
    • System.Data
    • System.Windows
    • System.Numerics
    • System.Core
    • System.ServiceModel
    • System.Net
    • System
    • System.IO
    • System.Linq
    • System.Xml
  15. Android – 100% API Coverage

    Slide 15 - Android – 100% API Coverage

    • Text-to-speech
    • ActionBar
    • Printing Framework
    • Renderscript
    • NFC
    • System.Data
    • System.Windows
    • System.Numerics
    • System.Core
    • System.ServiceModel
    • System.Net
    • System
    • System.IO
    • System.Linq
    • System.Xml
  16. Sharing Code

    Slide 16 - Sharing Code

    • Portable Class Libraries
    • Shared Projects
    • NuGet Support
    • 70% Shared Code!
  17. Office 365 API Features

    Slide 17 - Office 365 API Features

  18. USER

    Slide 18 - USER

    • FILES
    • EMAIL AND CONVERSATIONS
    • PEOPLE
    • EVENTS
    • Data silos in the enterprise
    • GROUPS
  19. Slide 19

    • DATA
    • USERS
    • HTML
    • Developer vision
  20. Simple REST/OData Service APIs

    Slide 20 - Simple REST/OData Service APIs

    • Part of Azure AD Common Consent Framework
    • Expose Files, Sites, Mail, Calendar, Users, Groups, Conversations and Notes
    • Videos, Yammer and OneNote in preview
    • Office 365 APIs
    • EVENTS
    • Mail
    • FILES
    • MANAGEMENT
  21. Single authentication flow

    Slide 21 - Single authentication flow

    • Azure AD Graph, Exchange, SharePoint
    • Mobile apps and web sites
    • Admin and end-user consent
    • Industry Standard 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
    • Azure AD and Office 365 APIs
    • 630: Get Your Hands Dirty with the Office 365 APIs, Authentication and SDKs
  22. Let’s see it

    Slide 22 - Let’s see it

    • in action!
  23. Developing for Office 365

    Slide 23 - Developing for Office 365

  24. Integrate Office 365 Services

    Slide 24 - Integrate Office 365 Services

    • Authenticate with Active Directory
    • Discover Available Services
    • Access Office 365
    • A Few Steps
  25. Integrate Office 365 Services

    Slide 25 - Integrate Office 365 Services

    • Authenticate with Active Directory
    • Discover Available Services
    • Access Office 365
    • A Few Steps
  26. Integrate Visual Studio applications with Office 365 API services

    Slide 26 - Integrate Visual Studio applications with Office 365 API services

    • Once the services are selected, Visual Studio performs the following:
    • Registers an Azure AD application (if there isn’t an application registered yet) in Microsoft Azure Active Directory to consume Office 365 services.
    • Applies the selected service permissions for the Azure AD application
    • Adds Office 365 API client libraries from Nuget for the configured services to the project.
    • Office 365 API Tools for Visual Studio 2015
  27. Azure Active Directory Graph Library (ADAL .NET)

    Slide 27 - Azure Active Directory Graph Library (ADAL .NET)

    • Office 365 API .NET Libraries
    • Exchange SDK (mail, contacts and calendar)
    • SharePoint SDK (files)
    • Azure Active Directory Graph Client Library SDK (users and groups)
    • Office 365 API SDKs
  28. Let’s take a look

    Slide 28 - Let’s take a look

    • Integrate your application with Office 365 APIs
  29. Integrate Office 365 Services

    Slide 29 - Integrate Office 365 Services

    • Authenticate with Active Directory
    • Discover Available Services
    • Access Office 365
    • A Few Steps
  30. Authentication Flow To Get Access Token

    Slide 30 - Authentication Flow To Get Access Token

    • Auth Context
    • Acquire Token
    • User Signs In
    • “If Required”
    • Auth Result
    • Tenant Id
    • //common or saved tenant
    • string tenantAuthority = "https://login.microsoftonline.com/{0}";
    • Access Token
    • ResourceId
    • ClientId
    • ReturnUri
    • AuthorizationParams
    • uses
    • “Authority”
    • uses
  31. Get Access Token

    Slide 31 - Get Access Token

    • var authContext = new AuthenticationContext(Authority);
    • AuthenticationResult authResult = null;
    • if(Settings.TenantId == "common")
    • authResult = await authContext.AcquireTokenAsync(resourceId, clientId, returnUri, PlatformParams);
    • else
    • authResult = await authContext.AcquireTokenSilentAsync(resourceId, clientId);
    • //Save tenant id for next authorization request.
    • Settings.TenantId = authResult.TenantId;
    • //We have the token!
    • authResult.AccessToken;
    • string tenantAuthority = "https://login.microsoftonline.com/{0}";
    • string Authority
    • {
    • get { return string.Format(tenantAuthority, Settings.TenantId); } }
  32. Helpers used for ADAL’s oAuth Page

    Slide 32 - Helpers used for ADAL’s oAuth Page

    • IPlatformParameters
    • //Shared Logic
    • public static IPlatformParameters PlatformParams { get; set; }
    • //Xamarin.iOS in UIViewController
    • AuthenticationHelper.PlatformParams = new PlatformParameters(this);
    • //Xamarin.Android in Activity
    • protected override void OnCreate(Bundle bundle) {
    • base.OnCreate(bundle);
    • AuthenticationHelper.PlatformParams = new PlatformParameters(this);
    • //..
    • }
    • protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) {
    • base.OnActivityResult(requestCode, resultCode, data);
    • AuthenticationAgentContinuationHelper.SetAuthenticationAgentContinuationEventArgs(requestCode, resultCode, data);
    • }
  33. Xamarin’s Unique Approach

    Slide 33 - Xamarin’s Unique Approach

    • iOS C# UI
    • Windows C# UI
    • Android C# UI
    • Shared C# Backend
  34. Platform Specific Code

    Slide 34 - Platform Specific Code

    • What if we didn’t have to write this code?
    • What if we could access it from shared code?
    • GPS, Text To Speech, Settings, Battery, Lights, Notifications, etc…
    • GPS, Text To Speech, Settings, Battery, Lights, Notifications, etc…
    • GPS, Text To Speech, Settings, Battery, Lights, Notifications, etc…
    • UI
    • UI
    • UI
  35. Plugins for Xamarin and Windows

    Slide 35 - Plugins for Xamarin and Windows

    • Access Platform Specific APIs from a Common API
    • From Anywhere:
    • Single Project
    • PCL
    • Shared Code
    • github.com/xamarin/plugins
  36. Settings Plugin for Xamarin and Windows

    Slide 36 - Settings Plugin for Xamarin and Windows

    • Save to:
    • NSUserDefaults
    • SharedPreferences
    • IsolatedStorage
    • ApplicationData
    • private const string TenantKey = "tenant_key";
    • private static readonly string TenantDefault = "common";
    • public static string TenantId
    • {
    • get
    • {
    • return AppSettings.GetValueOrDefault(TenantKey, TenantDefault);
    • }
    • set
    • {
    • AppSettings.AddOrUpdateValue(TenantKey, value);
    • }
    • }
  37. Let’s take a look

    Slide 37 - Let’s take a look

    • Authenticating to Office 365 APIs
  38. Integrate Office 365 Services

    Slide 38 - Integrate Office 365 Services

    • Authenticate with Active Directory
    • Discover Available Services
    • Access Office 365
    • A Few Steps
  39. Determine your app capabilities

    Slide 39 - Determine your app capabilities

    • Mail
    • Calendar
    • Contacts
    • Files
    • Sites
    • Determine Resource Id and Endpoint Uri of the Office 365 Service API
    • Office 365 Discovery Service API
  40. Discovery Client

    Slide 40 - Discovery Client

    • Discover Capability
    • Contacts, Mail, etc.
    • Create Client
    • Outlook, SharePoint, etc.
    • Get Access Token
    • Get Access Token
    • Access APIs
    • Gain Access to APIs
    • Discovery Result
    • //Used for Access Token
    • string discoveryServiceResourceId =
    • "https://api.office.com/discovery/";
    • ServiceEndpointUri
    • ServiceResourceId
  41. Discovery Client

    Slide 41 - Discovery Client

    • private static DiscoveryClient discoveryClient;
    • string discoveryServiceResourceId = "https://api.office.com/discovery/";
    • private async static Task<DiscoveryClient> GetDiscoveryClient()
    • {
    • if(discoveryClient != null)
    • return discoveryClient;
    • discoveryClient = new DiscoveryClient(async () => {
    • var authResult = await GetAccessToken(discoveryServiceResourceId);
    • return authResult.AccessToken;
    • });
    • return discoveryClient;
    • }
  42. Get Services Client

    Slide 42 - Get Services Client

    • private static async Task<OutlookServicesClient> GetOutlookClient(string capability)
    • {
    • var discoveryClient = await GetDiscoveryClient();
    • var discoveryResult = await discoveryClient.DiscoverCapabilityAsync(capability);
    • var outlookClient = new OutlookServicesClient(discoveryResult.ServiceEndpointUri,
    • async () => {
    • var authResult = await GetAccessToken(discoveryResult.ServiceResourceId);
    • return authResult.AccessToken;
    • });
    • return outlookClient;
    • }
    • Capabilities:
    • Calendar
    • Contacts
    • Mail
    • Clients:
    • OutlookServicesClient
    • SharePointServicesClient
  43. Integrate Office 365 Services

    Slide 43 - Integrate Office 365 Services

    • Authenticate with Active Directory
    • Discover Available Services
    • Access Office 365
    • A Few Steps
  44. USER

    Slide 44 - USER

    • PEOPLE
    • Directory
    • GROUPS
    • Azure Active Directory Graph API
    • https://graph.windows.net/contoso.com/users?api-version=1.5
    • https://graph.windows.net/contoso.com/groups?api-version=1.5
  45. USER

    Slide 45 - USER

    • PEOPLE
    • Extended Profile
    • GROUPS
    • SharePoint User Profile
    • https://contoso.sharepoint.com/_api/SP.UserProfiles.PeopleManager/GetMyProperties
    • Exchange HD Picture
    • https://outlook.office365.com/api/v1.0/me/userPhoto
  46. USER

    Slide 46 - USER

    • EMAIL AND CONVERSATIONS
    • EVENTS
    • Mail, calendar, contacts and conversations
    • GROUPS
    • Exchange REST API
    • https://outlook.office365.com/api/v1.0/me/Messages
    • https://outlook.office365.com/api/v1.0/me/Events
    • https://outlook.office365.com/api/v1.0/Me/Contacts/
    • PEOPLE
  47. USER

    Slide 47 - USER

    • FILES
    • Files
    • OneDrive for Business/SharePoint Files API
    • https://contoso-my.sharepoint.com/personal/yina_contoso_com/_api/v1.0/files
    • https://contoso.sharepoint.com/sites/designCouncil/_api/v1.0/files
    • PEOPLE
    • GROUPS
  48. Rich Query Syntax using OData

    Slide 48 - Rich Query Syntax using OData

    • Scenario
    • URL
    • Get 5 messages from Inbox
    • https://outlook.office365.com/api/v1.0/Me/Folders/Inbox/Messages?$top=5
    • Get selective properties on messages
    • https://outlook.office365.com/api/v1.0/Me/Folders/Inbox/Messages?$top=5&$select=From,DateTimeCreated,Subject
    • Get Inbox messages with subject and attachment info
    • https://outlook.office365.com/api/v1.0/Me/Folders/Inbox/Messages?$format=application/json;odata.metadata=none&$select=Subject&$expand=Attachments
    • Get count and selective props on messages with attachment(s)
    • https://outlook.office365.com/v1.0/Me/Folders/Inbox/Messages?$format=application/json;odata.metadata=none&$select=Subject&$filter=HasAttachments%20eq%20true&$count=true
    • Get contact with a given name
    • https://outlook.office365.com/v1.0/Me/Contacts/?$filter=Givenname eq ‘John’
    • 742: New Outlook REST APIs for Developing Against Outlook.com AND Office 365
  49. Office 365 Contacts

    Slide 49 - Office 365 Contacts

    • Common API operations
    • Reading contacts
    • Searching for contacts
    • Creating contacts
    • Deleting contacts
    • Editing events
    • Contact
  50. Gathering Contacts

    Slide 50 - Gathering Contacts

    • public static async Task<IEnumerable<IContact>> GetContacts()
    • {
    • var client = await Client.GetContactsClient();
    • // Obtain first page of contacts
    • var contactsResults = await (from i in client.Me.Contacts
    • orderby i.Surname
    • select i).Take(100).ExecuteAsync();
    • return contactsResults.CurrentPage;
    • }
  51. Lets take a look

    Slide 51 - Lets take a look

    • Office 365 with Xamarin in Action
  52. Current Status

    Slide 52 - Current Status

    • GET
    • DELETE
    • POST
    • PATCH/UPDATE
    • Use REST
    • Use REST
  53. Current Status

    Slide 53 - Current Status

    • GET
    • DELETE
    • POST
    • PATCH/UPDATE
    • Use REST
    • Use REST
  54. Xamarin – Your Complete Mobile Solution

    Slide 54 - Xamarin – Your Complete Mobile Solution

    • DESIGN – DEVELOP - INTEGRATE
    • TEST
    • MONITOR
    • LEARN
  55. Get started today xamarin.com

    Slide 55 - Get started today xamarin.com

  56. xamarin.com/university

    Slide 56 - xamarin.com/university

    • Unrivaled Mobile Development Training
    • Live unlimited mobile development training from mobile experts, in your time-zone, on your schedule, and as often as you'd like.
  57. http://dev.office.com/devprogram

    Slide 57 - http://dev.office.com/devprogram

    • Developer Program Launch
    • E-mail Newsletters
    • Free Developer Subscription
    • 1 YEAR FREE
    • Free Training
    • Free Tools
    • Webinars
  58. http://dev.office.com/devprogram

    Slide 58 - http://dev.office.com/devprogram

    • Developer Program Launch
    • E-mail Newsletters
    • Free Developer Subscription
    • 1 YEAR FREE
    • Free Training
    • Free Tools
    • Webinars