Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Mobile for SharePoint with Windows Phone

1,520 views

Published on

A survey of connectivity options available to folks who want to leverage their favorite business collaboration platform interacting with their favorite mobile client. Wverything from "non-app" solutions (stuff already in the smartphone) to C#/CSOM with a few alternatives in between.

Published in: Business, Technology
  • Be the first to comment

  • Be the first to like this

Mobile for SharePoint with Windows Phone

  1. 1. Mobile for SharePoint with Windows Phone Jim Wilcox Enterprise Software Application Architect Edgewater Technology
  2. 2. Agenda  Introductions  Client “Non-Apps”  SharePoint Web Interfaces  Development Tools / Silverlight  Office 365 SharePoint  Demo loading & updating SP List items on Windows Phone  Best Practices
  3. 3. Introductions: Myself  Jim Wilcox  Enterprise Software Application Architect  Edgewater Technology (GOLD SPONSOR THIS YEAR!)  Hobbyist Windows Phone App Publisher  Co-Founder of  Granite State (NH) SharePoint Users Group  Granite State (NH) Windows Phone Users Group  Co-Organizer of SharePoint Saturday New Hampshire
  4. 4. Introductions: Session  Survey of ways to create SharePoint-integrated clients on the Windows Phone platform… with a focus on apps  Based In Part On  “SharePoint 2010 and Windows Phone 7 Training Course”  http://msdn.microsoft.com/en-us/hh292769  Developer training | Apps for Office and SharePoint  (“MODULE 19: Create Mobile Apps for SharePoint 2013”)  http://msdn.microsoft.com/en-US/office/dn448488  Office 365 Integration  Demos / Code Walkthroughs
  5. 5. Quick Rundown on Client “Non-Apps”  May be helpful to consider tools already in the phone  Office Hub / SharePoint Workspaces  Internet Explorer  Desktop Mode  Mobile Mode
  6. 6. Quick Rundown on Client “Non-Apps”  Office Hub / SharePoint Workspaces  Pro’s  Readily available, “free”  Con’s  Not so nicely customizable
  7. 7. Quick Rundown on Client “Non-Apps”  Internet Explorer  Desktop Mode  Pros  Emulates desktop browser well  Fairly compatible, with lots of common functionality  Cons  Small, tough to navigate
  8. 8. Quick Rundown on Client Non-Apps  Internet Explorer  Mobile Mode  Pros  Still excellent support for compatibility  Improves visibility on small screen  Cons  Limited functionality  Limited User experience
  9. 9. SharePoint Web Interfaces  REST API (ODATA)  _api  RSS  Social Web services  Classic SOAP Web Service Interfaces (e.g. lists.asmx)  Client Side Object Model (CSOM)
  10. 10. SharePoint Client App Dev  Challenges (for any client)  Authentication  Config  Data Caching  Exception Handling  Windows Phone Challenges  Client Side Object Model not supported in WP7  NTLM authentication not available  Silverlight framework “limitations”  everything Async
  11. 11. Silverlight  SILVERLIGHT IS DEAD! LONG LIVE XAML!  WPF like, uses XAML  Stripped down .NET even compared to the .NET Client profile  Async everything
  12. 12. Silverlight  Dev Environment  Setting up PHONE Dev Environment  Visual Studio Express 2012 on Windows 8 (Requires Hyper-V for device emulation)  Windows Phone 8 SDK (Installed with Visual Studio 2012 & 2013)  Bing: “Microsoft SharePoint SDK for Windows Phone 8”  http://www.microsoft.com/en-us/download/details.aspx?id=36818  SharePoint 2013 server environment  CSOM has tools to support Windows Phone 8
  13. 13. Async  Communications in Silverlight force Async, multi- threading model.  Building UI’s with XAML  UI must be on single thread.  Deploy.Dispatch.BeginInvoke is key to getting back to UI thread
  14. 14. Demo: Walk-thru basic WSS3 app  Visual Studio 2012 Express for Windows Phone  GSSPUG Hub  Free App  WSS3 SOAP client  Anonymous Authentication
  15. 15. Office 365 Authentication  Multi-step process (DONE BY CSOM)
  16. 16. Office 365 Authentication (WITHOUT CSOM)  Send credentials to login server const string _authUrl="https://login.microsoftonline.com/extSTS.srf"; const string _samlXml = @"<s:Envelope xmlns:s=""http://www.w3.org/2003/05/soap-envelope"" xmlns:a=""http://www.w3.org/2005/08/addressing"" xmlns:u=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd""> <s:Header> <a:Action s:mustUnderstand=""1"">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</a:Action> <a:ReplyTo> <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address> </a:ReplyTo> <a:To s:mustUnderstand=""1"">https://login.microsoftonline.com/extSTS.srf</a:To> <o:Security s:mustUnderstand=""1"" xmlns:o=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd""> <o:UsernameToken> <o:Username>{0}</o:Username> <o:Password>{1}</o:Password> </o:UsernameToken> </o:Security> </s:Header> <s:Body> <t:RequestSecurityToken xmlns:t=""http://schemas.xmlsoap.org/ws/2005/02/trust""> <wsp:AppliesTo xmlns:wsp=""http://schemas.xmlsoap.org/ws/2004/09/policy""> <a:EndpointReference> <a:Address>{2}</a:Address> </a:EndpointReference> </wsp:AppliesTo> <t:KeyType>http://schemas.xmlsoap.org/ws/2005/05/identity/NoProofKey</t:KeyType> <t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType> <t:TokenType>urn:oasis:names:tc:SAML:1.0:assertion</t:TokenType> </t:RequestSecurityToken> </s:Body> </s:Envelope>";
  17. 17. Office 365 Authentication (WITHOUT CSOM)  Get SAML Token from Response <S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa="http://www.w3.org/2005/08/addressing"> <S:Header> … </S:Header> <S:Body> <wst:RequestSecurityTokenResponse xmlns:S="http://www.w3.org/2003/05/soap-envelope" xmlns:wst="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity- utility-1.0.xsd" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:psf="http://schemas.microsoft.com/Passport/SoapServices/SOAPFault"> <wst:TokenType>urn:passport:compact</wst:TokenType> <wsp:AppliesTo xmlns:wsa="http://www.w3.org/2005/08/addressing"> <wsa:EndpointReference> <wsa:Address>spsnh.sharepoint.com</wsa:Address> </wsa:EndpointReference> </wsp:AppliesTo> <wst:Lifetime> <wsu:Created>2012-09-21T18:17:56Z</wsu:Created> <wsu:Expires>2012-09-22T18:17:56Z</wsu:Expires> </wst:Lifetime> <wst:RequestedSecurityToken> <wsse:BinarySecurityToken Id="Compact0"> t=EwBYAk6hBwAUIQT64YiMbkZQLHdw6peopUrQ0O8AATjrlz3EJAc6fh4IdP8nOlEzhGUzO53lIa7CjgkoTNzz+BQguCDwabOvMsL7u3ygGx8Gm4LLQlOw9CR/UgUDls+fxvLTPRQr7nI3Auw21 3tJdnXs5PWs4um/78f2aY36j9tauBXoK/O6LIXIDI3KZIIor98P2lhtnWDB8gG1NVEWvhfuMEYDmL07YjkwDVruCbbnn9gERkZUwyPImiR0rV1PlnovxV+nNRNKo09IK4BSFaSBwcBfhDWB4Ai9/3Kw9 tL0lw4zhY0KJ0M4rd/YVDeUCjcA5gcL60fQ+gKh0lmYo2koRmzKuDpGjTan/Bo70CoMwh8d4jEqU8MSZliz2y4DZgAACJxQwcoLK56JKAGWzGAu/+QF47YofykIIXHLxmosMINTw7QZ6hdslEEu NQ3+bFaUUZeaP6nihF+XthZwiP5BIodcLhH7BG6XUCL9Wip9pGST1zU0xJ+rXJ2VtTde5kAJDhxp5OoO23VMTMbEmDi+eKaESORzU6j6ijtaGxZsr44ygPa3A/HsFUz+DKBk3EGCvmuMTZOuc3r h8Dd74jNp9ym4TVN+Ge6cvko7XmZJIVIqQQsLcTPt2UXl6UTnLMgiIw1CQXGACTBkkGrNFwswsY0AcUBtFv49ISyhlC0Y39ow0Tl8XL7es/HCVYZTCndEo3FKOBISG+a3Uy+45zqw+sU5X26Aq5U tlnQBUHoHMiO55EeOeByPu58NmpRebekOPQlD4VuVgbl3C/S4Zodp2bCH1WIB&amp;p= </wsse:BinarySecurityToken> </wst:RequestedSecurityToken> … </S:Body> </S:Envelope>
  18. 18. Office 365 Authentication (WITHOUT CSOM)  Present SAML token to web service const string _login="/_forms/default.aspx?wa=wsignin1.0"; private void SubmitTokenAsync() { UriBuilder bldr = new UriBuilder(_uri.Scheme, _uri.Host, _uri.Port); _submitTokenRequest = HttpWebRequest.CreateHttp(bldr.Uri + _login); _submitTokenRequest.CookieContainer = Cookies; _submitTokenRequest.Method = "POST"; _submitTokenRequest.BeginGetRequestStream(new AsyncCallback(Get_SubmitToken_RequestStreamCallback), null); } private void Get_SubmitToken_RequestStreamCallback(IAsyncResult result) { var requestStream = _submitTokenRequest.EndGetRequestStream(result); using (StreamWriter w = new StreamWriter(requestStream)) { w.Write(_token); w.Flush(); } _submitTokenRequest.BeginGetResponse(new AsyncCallback(Get_SubmitToken_ResponseCallback), null); }
  19. 19. Office 365 Authentication (WITHOUT CSOM)  Include cookie in GetListItems service call. private void Get_SubmitToken_ResponseCallback(IAsyncResult result) { UriBuilder bldr = new UriBuilder(_uri.Scheme, _uri.Host, _uri.Port); bldr.Path = null; Cookies = _submitTokenRequest.CookieContainer; _isAuthenticationInProgress = false; IsAuthenticated = true; if (OnAuthenticated != null) { EventArgs args = new EventArgs(); OnAuthenticated(this, args); //Call back the parent } } ----------------- parent _listsClient = new ListsSoapClient(); void OnAuthenticated_GetTasks(object sender, EventArgs e) { _authenticationHelper = (SPAuthenticationHelper)sender; _listsClient.CookieContainer = _authenticationHelper.Cookies; BeginGetTasksList(); }
  20. 20. Windows Phone 8 / SharePoint 2013  MS Training video was outdated…  ….VS 2012, not 2010  …. WP8 not WP7  …. Office 365  “List” apps  CSOM  Push notifications
  21. 21. DEMO: “List” App
  22. 22. CSOM  Variant of CSOM used by SharePoint 2010  To say authentication is simplified… public class ListDataProvider : ListDataProviderBase { /// <summary> /// Provides access to ClientContext object which is used to execute queries to fetch ListItems from SharePoint server /// </summary> private ClientContext m_Context; public override ClientContext Context { get { if (m_Context != null) return m_Context; m_Context = new ClientContext(SiteUrl); Authenticator at = new Authenticator(); at.CookieCachingEnabled = true; //Allows authenticator to save cookies for future usage // In case of Microsoft Online federated authentication, set ADFS authentication scheme preference for passive authentication // Example, to set client preference for SAML 2.0 username-password authentication scheme: // at.FederationPassiveAuthUri = "urn:oasis:names:tc:SAML:2.0:ac:classes:Password"; m_Context.Credentials = at; return m_Context; } }
  23. 23. Push Notifications  Device requests URI from PNS  Device registers URI with SharePoint App  SharePoint app is implemented to send notification via PNS to URI,  which in turn pings the phone.
  24. 24. Push Notification Types  Toast  Appears at top of UI inside or outside of app  Tile  Updates live tile info  Raw  Notification event raised to app, which implements its own handler (app must be running)
  25. 25. Alternative: App Studio  Into  Demo
  26. 26. Best Practices  Isolated Storage / Offline Mode  Proper Exception Handling  Proper Logging  Proper Configuration  Security / Encryption  Be Bandwidth Aware (compression, caching where possible)  Be Memory Aware
  27. 27. More Best Practices  Unit Testing  UI Lipstick  App Publishing
  28. 28. Additional Technologies  Lightswitch  HTML5 / JS  Xamarin
  29. 29. Questions?
  30. 30. Thank You  For taking personal time to make this presentation and event a part of your professional portfolio  Feel free to connect with me on:  Facebook: http://www.facebook.com/jwilcox1701  LinkedIn: http://www.linkedin.com/in/jimwilcox2  Twitter: @GraniteStHacker  Blog: http://GraniteStateHacker.kataire.com  Granite State (NH) SharePoint Users Group: http://www.granitestatesharepoint.com  Granite State (NH) Windows Phone Users Group: http://granitestatewinphone.Eventbrite.com  Yammer, Foursquare, Klout….

×