1 / 57

Extending SharePoint Online met Windows 8 apps

Michaël Hompus Sander Bosman. Extending SharePoint Online met Windows 8 apps . Voorstellen. Michaël Hompus Principal developer michael.hompus@winvision.nl @eNeRGy164. Sander Bosman Senior developer sander.bosman@winvision.nl @ Sander_B. Voorstellen. Onderwijs. Zorg. Goede doelen.

cwen
Download Presentation

Extending SharePoint Online met Windows 8 apps

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Michaël Hompus Sander Bosman Extending SharePoint Online met Windows 8 apps

  2. Voorstellen Michaël Hompus Principaldeveloper michael.hompus@winvision.nl @eNeRGy164 Sander Bosman Senior developer sander.bosman@winvision.nl @Sander_B

  3. Voorstellen Onderwijs Zorg Goede doelen Innovatieteam

  4. Agenda • Voorstellen • Doelstelling • Authenticatie • SharePoint interfaces • Windows 8 andbeyond…

  5. Doelstelling • Als bedrijf willen we een centrale plek om informatie over onze projecten en referenties gemakkelijk bij te kunnen houden • Als een medewerker van het bedrijf wil ik een Windows 8 app zodat ik onderweg informatie over projecten en referenties kan opzoeken ook als ik geen dataverbinding heb

  6. Authenticatie

  7. Authenticatie • Hoe krijg je bedrijfsaccounts in SharePoint Online? • Hoe kan je authenticeren tegen SharePoint Online vanuit een Windows 8 app? • Hoe sla je credentials op in een Windows 8 app

  8. AD accounts in SharePoint Online

  9. AD accounts in SharePoint Online Wens: Medewerker moet met het bedrijfs-account (AD) kunnen inloggen op de app. Oplossing:DirSync Verschillende opties: • DirSync AD Accounts • DirSync AD Accounts met Wachtwoord Same Sign-On • DirSync AD Accounts i.c.m. ADFS Single Sign-On

  10. AD accounts in SharePoint Online

  11. AD accounts in SharePoint Online

  12. Authenticatie

  13. Authenticatie - Architectuur https://login.microsoftonline.com/extSTS.srf https://<tenant>.sharepoint.com/_forms/default.aspx?wa=wsignin1.0 https://<tenant>.sharepoint.com/_vti_bin/ListData.svc

  14. Authenticatie - Meer informatie • How to do active authentication to Office 365 and SharePoint Online - Wictor Wilén http://www.wictorwilen.se/Post/How-to-do-active-authentication-to-Office-365-and-SharePoint-Online.aspx

  15. Authenticatie - Architectuur https://login.microsoftonline.com/extSTS.srf

  16. Authenticatie – Token Request https://<tenant>.sharepoint.com

  17. Authenticatie – Token Response

  18. Authenticatie - Architectuur https://login.microsoftonline.com/extSTS.srf https://<tenant>.sharepoint.com/_forms/default.aspx?wa=wsignin1.0

  19. Authenticatie – Login Request

  20. Authenticatie – Login Response

  21. Authenticatie - Architectuur https://login.microsoftonline.com/extSTS.srf https://<tenant>.sharepoint.com/_forms/default.aspx?wa=wsignin1.0 https://<tenant>.sharepoint.com/_vti_bin/ListData.svc

  22. Authenticatie – Data Request

  23. Authenticatie – Data Response

  24. Credentials opslaan in de app

  25. Password Vault - Store varpasswordVault = newPasswordVault(); varpasswordCredentials = passwordVault.RetrieveAll(); foreach (varpasswordCredentialinpasswordCredentials) { try { if (passwordCredential.Resource == WinvisionDosyeAccount && passwordCredential.UserName == credentials.Username) { passwordVault.Remove(passwordCredential); } } catch (COMException) { // No password found } } var credential = newPasswordCredential(WinvisionDosyeAccount, credentials.Username, credentials.Password); passwordVault.Add(credential);

  26. Password Vault - Retrieve varpasswordVault = newPasswordVault(); var credentials = passwordVault.RetrieveAll(); foreach (varpasswordCredentialin credentials) { try { if (passwordCredential.Resource != WinvisionDosyeAccount) { continue; } passwordCredential.RetrievePassword(); returnnewCredentials { Username = passwordCredential.UserName, Password = passwordCredential.Password, }; } catch (COMException) { // No password found } }

  27. Credential Manager

  28. SharePoint interfaces

  29. SharePoint interfaces • Welke SharePoint interfaces kan ik gebruiken • Hoe kan ik lijsten, managed metadata en bestanden opvragen • Welke voor- en nadelen hebben de verschillende interfaces

  30. SharePoint interfaces • Server object model • Silverlightclient object model • JavaScriptclient object model • .NET Framework client object model • Mobile client object model • REST/ODataendpoints • Web Services • Remote Procedure Call

  31. SharePoint lijsten

  32. SharePoint lijsten WCF Data Services • LINQ queries tegen databron • …/_vti_bin/listdata.svc • WCF Data Services Tools for Windows Store Apps http://www.microsoft.com/en-us/download/details.aspx?id=30714 Standaard niet awaitable • Async extension methods for DataServiceContext https://gist.github.com/Phanatic/3427256

  33. SharePoint lijsten Cookie moet meegegeven worden • var context = newInnovatieDataContext(newUri(string.Format("{0}/_vti_bin/listdata.svc", this.settingsService.GetSharePointUri()))); • context.SendingRequest += this.ContextOnSendingRequest; • varresult = newList<Customer>(); • var query = (DataServiceQuery<Customer>)context.Klanten.Select(c => newCustomer • { • Id = c.Id, • Name = c.Titel, • AccountManagerId = c.AccountManagerId, • ServiceManagerId = c.ServiceManagerId, • VerticalId = c.VerticalId, • LogoPath = c.Logo, • Telephone = c.Telefoonnummer, • Website = c.Website, • Email = c.Email • }); • varcustomers = awaitquery.ExecuteAsync(); • result.AddRange(customers); privatevoidContextOnSendingRequest(objectsender, SendingRequestEventArgssendingRequestEventArgs) { sendingRequestEventArgs.RequestHeaders["Cookie"] = this.settingsService.GetCookieContainer(); }

  34. SharePoint lijsten Issue: • Veldnamen in queries zijn taalafhankelijk • Na enige inactiviteit regeert SharePoint Online op het eerste request altijd in het Engels! • DataServiceClientException

  35. Managed metadata

  36. Managed metadata Kan je niet ophalen met listdata.svc REST API • …/_api/ • HttpClient /_api/web/lists/getbytitle('Referenties')/Items?$select=Id,Microsoft_x0020_technieken

  37. Managedmetadata • Cookie moet meegegeven worden • JSON.NET om resultaten te verwerken varcookieContainer = newCookieContainer(); cookieContainer.SetCookies(newUri(this.settingsService.GetSharePointUri()), cookieHeader); varclient = newHttpClient(newHttpClientHandler { CookieContainer = cookieContainer }); client.DefaultRequestHeaders.Add("Cookie", cookieHeader); client.DefaultRequestHeaders.Accept.ParseAdd("application/json;odata=verbose"); var response = awaitclient.GetStringAsync( string.Format("{0}/_api/web/lists/getbytitle('Referenties')/Items? $select=Id,Microsoft_x0020_technieken", this.settingsService.GetSharePointUri())); • varjson = JObject.Parse(response); • varmanagedMetadata = from i injson["d"]["results"].Children().Where(g => g["Microsoft_x0020_technieken"]["results"].Any()) • selectnew • { • Id = (int)i["Id"], • Labels = i["Microsoft_x0020_technieken"]["results"].Values<string>("Label").ToArray() • }; • varmicrosoftTechnologies = managedMetadata.ToDictionary(m => m.Id, m => m.Labels);

  38. Bestanden

  39. Bestanden

  40. Bestanden Attachments = c.Bijlagen.Select(b => newAttachment { Title = b.Name, SharePointPath = string.Format("{0}/Lists/{1}/Attachments/{2}/{3}", this.settingsService.GetSharePointUri(), b.EntitySet, b.ItemId, b.Name) }),

  41. Bestanden varcookieContainer = newCookieContainer(); cookieContainer.SetCookies(newUri(this.settingsService.GetSharePointUri()), cookieHeader); • var buffer = newbyte[] { } using (varclient = newHttpClient(newHttpClientHandler { CookieContainer = cookieContainer })) { buffer = awaitclient.GetByteArrayAsync(uri); } • var images = awaitApplicationData.Current.LocalFolder.CreateFolderAsync(folder, CreationCollisionOption.OpenIfExists); • var file = awaitimages.CreateFileAsync(cacheKey, CreationCollisionOption.ReplaceExisting); • awaitFileIO.WriteBytesAsync(file, buffer);

  42. “run-with-cookies”

  43. Uitdagingen Alles in Windows 8 Async • Wat doe je als je nog geen cookie hebt • Wat doe je als je cookie is verlopen • Met meerdere requests tegelijk • Met meerdere technieken • DataContext • HttpClient • En met mogelijke fouten die optreden

  44. “run-with-cookies”

  45. Windows 8 andbeyond

  46. Andere devices Universal apps • Windows 8.1 update • Windows Phone 8.1 • Xbox One

  47. Windows 8.1 app

More Related