42
AMBIENT INTELLIGENCE tech days 2015 # mstechdays techdays.microsoft.fr

365 raisons d’inclure Office365 dans vos apps mobiles (Authentifications, Listes, Agenda dans vos Apps crossplateform)

Embed Size (px)

Citation preview

AMBIENT INTELLIGENCE

tech days•

2015

#mstechdays techdays.microsoft.fr

tech.days 2015#mstechdaysSESSION

Loïs GaudebertConsultant mobilité

[email protected]

Remi AubertConsultant développement

[email protected]

AI3Pure Player Microsoft

Paris

Nantes

Toulouse

Aix-en-Provence

tech.days 2015#mstechdaysSESSION

L’authentification

L’accès au calendrier, contacts et mails

L’accès aux listes

L’accès aux fichiers

tech.days 2015#mstechdaysSESSION

tech.days 2015#mstechdaysSESSION

l’UX de chaque plateforme

C# & .Net Framework

partager du code entre les plateformes

les performances natives de chaque plateforme

tech.days 2015#mstechdaysSESSION

IHM native

Avec partage du

code métier

tech.days 2015#mstechdaysSESSION

IHM en XAML

Avec partage du

code métier

tech.days 2015#mstechdaysSESSION

tech.days 2015#mstechdaysSESSION

tech.days 2015#mstechdaysSESSION

tech.days 2015#mstechdaysSESSION

tech.days 2015#mstechdaysSESSION

tech.days 2015#mstechdaysSESSION

Mail

Calendrier

Contact

Sites

Fichiers (OneDrive For Business)

Utilisateurs

Organisation

tech.days 2015#mstechdaysSESSION

tech.days 2015#mstechdaysSESSION

https://portal.office.com/Signup/Signup.aspx?OfferId=C69E7747-2566-4897-8CBA-B998ED3BAB88&DL=DEVELOPERPACK&ali=1#0

tech.days 2015#mstechdaysSESSION

Les mains dans le cambouis :SDK pour Store Apps

tech.days 2015#mstechdaysSESSION

1 2

tech.days 2015#mstechdaysSESSION

3

4

_authenticationContext = new AuthenticationContext(authority);var token = await GetTokenHelperAsync(_authenticationContext, AadServiceResourceId);

var eventsResults = await exchangeClient.Me.Calendar.Events.OrderBy(e => e.Start).ExecuteAsync();

tech.days 2015#mstechdaysSESSION

Les mains dans le cambouis :SDK API pour Xamarin.Forms

tech.days 2015#mstechdaysSESSION

1

2

tech.days 2015#mstechdaysSESSION

Tous les utilisateurs d’un tenant Office 365 sont gérés par un tenant Azure Active Directory

Azure Active Directory va gérer la sécurisation des accès à l’API Office 365 par d’autres applications

tech.days 2015#mstechdaysSESSION

Se noter : Client ID

Key (client secret)

Redirect/Sign-On URI

tech.days 2015#mstechdaysSESSION

tech.days 2015#mstechdaysSESSION 16/02/201

5

Librairie utilisée pour la gestion de l’authentification

Gestion des token et des refresh token

Compatible Azure Active Directory et ADFS

ADAL est disponible sur différentes plateformes

.NET, Windows Store, Windows Phone, iOS, Android, Node.JS, AngularJS, Java,

Xamarin

tech.days 2015#mstechdaysSESSION

tech.days 2015#mstechdaysSESSION

//Création d’un contexteAuthenticationContext = new AuthenticationContext(CommonAuthority);

//Vérification si un cache existeif (AuthenticationContext.TokenCache.ReadItems().Count() > 0)

AuthenticationContext = new AuthenticationContext(AuthenticationContext.TokenCache.ReadItems().First().Authority);

//Authentificationvar authResult = await AuthenticationContext

.AcquireTokenAsync(ResourceUri, ClientId, ReturnUri, AuthorizationParameters); var token = authResult.AccessToken;

tech.days 2015#mstechdaysSESSION

tech.days 2015#mstechdaysSESSION

//Obtention du calendriervar Events = await outlookClient.Me.Calendar.Events

.Where(e => e.Start >= startDate && e.Start < endDate).ExecuteAsync();

//Ajout d’un rendez-vousEvent newEvent = new Event{

Subject = EventName,Location = location,Start = start, End = end

};await exchangeClient.Me.Events.AddEventAsync(newEvent);

tech.days 2015#mstechdaysSESSION

//Obtention de contactsvar contactsResults = await exchangeClient.Me.Contacts

.OrderBy(c => c.DisplayName).ExecuteAsync();

//Ajout d’un contactContact newContact = new Contact{

GivenName = givenName,Surname = surname, JobTitle = jobTitle, MobilePhone1 = mobilePhone

}; await exchangeClient.Me.Contacts.AddContactAsync(newContact);

tech.days 2015#mstechdaysSESSION

//Obtention des mailsvar mails = await(from i in outlookClient.Me.Folders.GetById("Inbox").Messages

orderby i.DateTimeReceived descendingselect i).Skip((pgNo - 1) * pgSize).Take(pgSize).ExecuteAsync();

//Envoi de mailvar draft = new Message{

Subject = subject,Body = new ItemBody {ContentType = BodyType.Text,Content = bodyContent},ToRecipients = toRecipients

};await outlookClient.Me.SendMailAsync(draft, true);

tech.days 2015#mstechdaysSESSION

tech.days 2015#mstechdaysSESSION

string requestUrl = string.Format("{0}/_api/lists/getbytitle('{1}')/items",SharepointUrl, listName);

var client = new HttpClient();client.DefaultRequestHeaders.Authorization =

new AuthenticationHeaderValue("Bearer", Token);HttpResponseMessage response = await client.GetAsync(new Uri(requestUrl));

var items = DeserializeItem(response)

tech.days 2015#mstechdaysSESSION

tech.days 2015#mstechdaysSESSION

//Obtention des fichiersvar filesResults = await sharePointClient.Files.ExecuteAsync();

//Ajout d’un fichierusing (var stream = await sFile.OpenStreamForReadAsync()){

File newFile = new File{Name = sFile.Name};await sharePointClient.Files.AddItemAsync(newFile);await sharePointClient.Files.GetById(newFile.Id).ToFile().UploadAsync(stream);

}

tech.days 2015#mstechdaysSESSION

Scénarios d’usage

tech.days 2015#mstechdaysSESSION

Situation de mobilité

Prise de photo

Géolocalisation

Agenda et Prise de rendez-vous automatique

Synchronisation hors-ligne

tech.days 2015#mstechdaysSESSION

Documentation

Personalisation

Envoi de devis

Notification pour relance commerciale

tech.days 2015#mstechdaysSESSION

Indicateurs

Supervision

Suivi détaillé

tech.days 2015#mstechdaysSESSION

Speakers : [email protected]@ai3.fr

tech.days 2015#mstechdaysSESSION

© 2015 Microsoft Corporation. All rights reserved.

tech days•

2015

#mstechdays techdays.microsoft.fr