Skip to content

azugfr/RedShirtTour-MSGraphAPI-Lab_Xamarin

Repository files navigation

RedShirtTour-MSGraphAPI-Lab_Xamarin

Red Shirt Tour Paris 2018 - Hands On Lab MS Graph API

Table of contents

Introduction

This Repo will help you step by step throw exercices to implement Graph API in a Xamarin Forms application. Connection to Graph API, get all groups, list in a view all events associated, display event informations and Subscribe to one.

Exercices

This sample requires the following:

If you want to run the iOS project in this sample, you'll need the following:

You can use the Visual Studio Emulator for Android if you want to run the Android project.

Exercice 1 : Register and configure the app

  1. Into the App Registration Portal using your account provide during the Red Shirt Dev Tour Lab session.

  2. Select Add an app.

  3. Enter a name for the app, and select Create.

    The registration page displays, listing the properties of your app.

  4. Under Platforms, select Add platform.

  5. Select Native Application.

  6. Copy the Application Id value and the Custom Redirect URI value (under the Native Application header) that was created for you when you added the Native Application platform. This URI should contain your Application Id value and be in this form: msal<Application Id>://auth You'll need to enter these values into the sample app.

    The app id is a unique identifier for your app.

  7. Select Save.

Exercice 1 : Implement AuthentificationService

  1. Command are already implemented in the MainViewModel
  2. A exception will occure during the run time because the AuthentificationService is not created.
  3. We are going to create a singleton GraphServiceClient object in GetAuthenticatedClient()
  4. GraphServiceClient needs :
    1. A url (https://graph.microsoft.com/v1.0)
    2. A DelegateAuthenticationProvider with a TOKEN and a simple AuthorizationHEader
    3. The token can be retrived by a simple async method that we will create GetTokenForUserAsync()
    4. GraphLibrary provide a method that generate a WebView AcquireTokenAsync
    5. We need to managed this call multiple time. Save the token and managed the expirationTime (Let's say 5 mins)
  5. Implement a sign Out method that erase all object

Exercice 2 : Implement GroupService

Exercice 3 : Implement GroupService

Step1 Step2 Step3 Step4
Step1 Step2 Step3 Step4

Copyright

Copyright (c) 2017 Cellenza. All rights reserved. Lab Red Shirt Dev Tour 23 January 2018

About

Red Shirt Tour Paris 2018 - Hands On Lab MS Graph API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages