![Page 1: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/1.jpg)
Extending SharePoint Online met Windows 8 apps
Michaël Hompus
Sander Bosman
![Page 2: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/2.jpg)
VoorstellenMichaël HompusPrincipal [email protected]@eNeRGy164
Sander BosmanSenior [email protected]@Sander_B
![Page 3: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/3.jpg)
Voorstellen
Innovatieteam
Onderwijs Zorg Goede doelen
![Page 4: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/4.jpg)
Agenda• Voorstellen• Doelstelling• Authenticatie• SharePoint interfaces• Windows 8 and beyond…
![Page 5: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/5.jpg)
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
![Page 6: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/6.jpg)
DEMO
![Page 7: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/7.jpg)
Authenticatie
![Page 8: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/8.jpg)
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
![Page 9: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/9.jpg)
AD accounts in SharePoint Online
![Page 10: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/10.jpg)
AD accounts in SharePoint OnlineWens: Medewerker moet met het bedrijfs-account (AD) kunnen inloggen op de app.
Oplossing: DirSyncVerschillende opties:• DirSync AD Accounts• DirSync AD Accounts met Wachtwoord
Same Sign-On
• DirSync AD Accounts i.c.m. ADFSSingle Sign-On
![Page 11: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/11.jpg)
AD accounts in SharePoint Online
![Page 12: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/12.jpg)
AD accounts in SharePoint Online
![Page 13: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/13.jpg)
Authenticatie
![Page 14: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/14.jpg)
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
![Page 15: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/15.jpg)
Authenticatie - Meer informatie• How to do active authentication to Office 365 and SharePoint Online - Wictor Wilénhttp://www.wictorwilen.se/Post/How-to-do-active-authentication-to-Office-365-and-SharePoint-Online.aspx
![Page 16: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/16.jpg)
DEMO
![Page 17: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/17.jpg)
Authenticatie - Architectuur
https://login.microsoftonline.com/extSTS.srf
![Page 18: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/18.jpg)
Authenticatie – Token Request
https://<tenant>.sharepoint.com
![Page 19: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/19.jpg)
Authenticatie – Token Response
![Page 20: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/20.jpg)
Authenticatie - Architectuur
https://login.microsoftonline.com/extSTS.srf
https://<tenant>.sharepoint.com/_forms/default.aspx?wa=wsignin1.0
![Page 21: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/21.jpg)
Authenticatie – Login Request
![Page 22: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/22.jpg)
Authenticatie – Login Response
![Page 23: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/23.jpg)
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
![Page 24: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/24.jpg)
Authenticatie – Data Request
![Page 25: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/25.jpg)
Authenticatie – Data Response
![Page 26: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/26.jpg)
Credentials opslaan in de app
![Page 27: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/27.jpg)
Password Vault - Store
var passwordVault = new PasswordVault();var passwordCredentials = passwordVault.RetrieveAll(); foreach (var passwordCredential in passwordCredentials){ try { if (passwordCredential.Resource == WinvisionDosyeAccount && passwordCredential.UserName == credentials.Username) {
passwordVault.Remove(passwordCredential); } } catch (COMException) { // No password found }} var credential = new PasswordCredential(WinvisionDosyeAccount, credentials.Username, credentials.Password); passwordVault.Add(credential);
![Page 28: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/28.jpg)
Password Vault - Retrievevar passwordVault = new PasswordVault();var credentials = passwordVault.RetrieveAll();
foreach (var passwordCredential in credentials){ try { if (passwordCredential.Resource != WinvisionDosyeAccount) {
continue; } passwordCredential.RetrievePassword(); return new Credentials
{ Username = passwordCredential.UserName, Password = passwordCredential.Password,
}; } catch (COMException) { // No password found }}
![Page 29: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/29.jpg)
Credential Manager
![Page 30: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/30.jpg)
SharePoint interfaces
![Page 31: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/31.jpg)
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
![Page 32: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/32.jpg)
SharePoint interfaces• Server object model• Silverlight client object model• JavaScript client object model• .NET Framework client object model• Mobile client object model• REST/OData endpoints• Web Services• Remote Procedure Call
![Page 33: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/33.jpg)
SharePoint lijsten
![Page 34: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/34.jpg)
SharePoint lijstenWCF Data Services• LINQ queries tegen databron• …/_vti_bin/listdata.svc• WCF Data Services Tools for Windows Store Appshttp://www.microsoft.com/en-us/download/details.aspx?id=30714
Standaard niet awaitable• Async extension methods for DataServiceContexthttps://gist.github.com/Phanatic/3427256
![Page 35: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/35.jpg)
var context = new InnovatieDataContext(new Uri(string.Format("{0}/_vti_bin/listdata.svc", this.settingsService.GetSharePointUri())));context.SendingRequest += this.ContextOnSendingRequest;
var result = new List<Customer>();
var query = (DataServiceQuery<Customer>)context.Klanten.Select(c => new Customer { 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 });
var customers = await query.ExecuteAsync();
result.AddRange(customers);
SharePoint lijstenCookie moet meegegeven worden
private void ContextOnSendingRequest(object sender, SendingRequestEventArgs sendingRequestEventArgs){
sendingRequestEventArgs.RequestHeaders["Cookie"] = this.settingsService.GetCookieContainer();}
![Page 36: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/36.jpg)
SharePoint lijstenIssue:• Veldnamen in queries zijn taalafhankelijk• Na enige inactiviteit regeert SharePoint Online op het eerste request altijd in het Engels!• DataServiceClientException
![Page 37: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/37.jpg)
Managed metadata
![Page 38: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/38.jpg)
Managed metadataKan je niet ophalen met listdata.svc
REST API• …/_api/• HttpClient
/_api/web/lists/getbytitle('Referenties')/Items?$select=Id,Microsoft_x0020_technieken
![Page 39: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/39.jpg)
Managed metadata• Cookie moet meegegeven worden• JSON.NET om resultaten te verwerken
var cookieContainer = new CookieContainer();cookieContainer.SetCookies(new Uri(this.settingsService.GetSharePointUri()), cookieHeader);
var client = new HttpClient(new HttpClientHandler { CookieContainer = cookieContainer });client.DefaultRequestHeaders.Add("Cookie", cookieHeader);client.DefaultRequestHeaders.Accept.ParseAdd("application/json;odata=verbose");
var response = await client.GetStringAsync( string.Format("{0}/_api/web/lists/getbytitle('Referenties')/Items? $select=Id,Microsoft_x0020_technieken", this.settingsService.GetSharePointUri()));
var json = JObject.Parse(response);
var managedMetadata = from i in json["d"]["results"].Children().Where(g => g["Microsoft_x0020_technieken"]["results"].Any()) select new { Id = (int)i["Id"], Labels = i["Microsoft_x0020_technieken"]["results"].Values<string>("Label").ToArray() };
var microsoftTechnologies = managedMetadata.ToDictionary(m => m.Id, m => m.Labels);
![Page 40: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/40.jpg)
Bestanden
![Page 41: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/41.jpg)
Bestanden
![Page 42: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/42.jpg)
Bestanden
Attachments = c.Bijlagen.Select(b => new Attachment { Title = b.Name, SharePointPath = string.Format("{0}/Lists/{1}/Attachments/{2}/{3}",
this.settingsService.GetSharePointUri(), b.EntitySet, b.ItemId, b.Name)
}),
![Page 43: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/43.jpg)
Bestanden
var cookieContainer = new CookieContainer();cookieContainer.SetCookies(new Uri(this.settingsService.GetSharePointUri()), cookieHeader);
var buffer = new byte[] { }
using (var client = new HttpClient(new HttpClientHandler { CookieContainer = cookieContainer })){ buffer = await client.GetByteArrayAsync(uri);}
var images = await ApplicationData.Current.LocalFolder.CreateFolderAsync(folder, CreationCollisionOption.OpenIfExists);var file = await images.CreateFileAsync(cacheKey, CreationCollisionOption.ReplaceExisting);
await FileIO.WriteBytesAsync(file, buffer);
![Page 44: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/44.jpg)
“run-with-cookies”
![Page 45: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/45.jpg)
UitdagingenAlles 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
![Page 46: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/46.jpg)
“run-with-cookies”Start
Lees cookie uit opgeslagen settings
Is er een cookie?
Remote Request
Is er een fout opgestreden?
Done
Wordt er al een cookie opgehaald
J a
J a
Nee
Haal cookie op en sla op in settings
Nee Nee
Is het de Office 365 bug?
Is het cookie verlopen?
J a
J a Nee
J a
Nee
Exception
![Page 47: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/47.jpg)
Windows 8 and beyond
![Page 48: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/48.jpg)
Andere devicesUniversal apps• Windows 8.1 update• Windows Phone 8.1• Xbox One
![Page 49: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/49.jpg)
DEMO
![Page 50: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/50.jpg)
Windows 8.1 app
![Page 51: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/51.jpg)
Make universal
![Page 52: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/52.jpg)
Windows Phone 8.1
![Page 53: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/53.jpg)
Andere devicesXamarin• Android• iOS
![Page 54: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/54.jpg)
DEMO
![Page 55: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/55.jpg)
Android
![Page 56: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/56.jpg)
Vragen?
![Page 57: Extending SharePoint Online met Windows 8 apps. Voorstellen](https://reader036.vdocuments.us/reader036/viewer/2022062621/551c2f555503469e4f8b6268/html5/thumbnails/57.jpg)
THANK YOU