Extending SharePoint Online met Windows 8 apps
Voorstellen
OnderwijsZorgGoede doelen
Agenda
Doelstelling
Demo
Authenticatie
AD accounts in SharePoint Online
Authenticatie
Authenticatie - Architectuur
Authenticatie - Meer informatie
Demo
Authenticatie - Architectuur
Authenticatie – Token Request
Authenticatie – Token Response
Authenticatie - Architectuur
Authenticatie – Login Request
Authenticatie – Login Response
Authenticatie - Architectuur
Authenticatie – Data Request
Authenticatie – Data Response
Credentials opslaan in de app
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);
Password Vault - Retrieve var 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 } }
Credential Manager
SharePoint interfaces
SharePoint lijsten
var context = new InnovatieDataContext(new Uri(string.Format("{0}/_vti_bin/listdata.svc", this.settingsService.GetSharePointUri()))); context.SendingRequest += this.ContextOnSendingRequest; var result = new List (); var query = (DataServiceQuery )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, = c. }); var customers = await query.ExecuteAsync(); result.AddRange(customers); SharePoint lijsten private void ContextOnSendingRequest(object sender, SendingRequestEventArgs sendingRequestEventArgs) { sendingRequestEventArgs.RequestHeaders["Cookie"] = this.settingsService.GetCookieContainer(); }
SharePoint lijsten
Managed metadata
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 ("Label").ToArray() }; var microsoftTechnologies = managedMetadata.ToDictionary(m => m.Id, m => m.Labels);
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) }),
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);
“run-with-cookies”
Uitdagingen
“run-with-cookies”
Windows 8 and beyond
Andere devices
Demo
Windows 8.1 app
Make universal
Windows Phone 8.1
Andere devices
Demo
Android
Vragen?
THANK YOU