Excellence in Software Engineering Client-Side Object Model MS SharePoint CSOM Belarus SharePoint User Group © 2012, by Ivan Padabed
Excellence in Software Engineering 2 SharePoint Data Access CONTENT CC: DOCUMENTUM 2007 technologies SPQuery SiteMap Provider Cross-site query LINQRESTClient OMSilverlightWCF New for 2010
Excellence in Software Engineering 3 Data Access Use JSON / XML Client technologies: –WPF –WinForm –Office –Silverlight –Javascript SharePoint Data SharePoint API Client.svc Client Application
Excellence in Software Engineering 4 Main objects: User Interface Site Web List Form View FolderFileWebPart NavigationNavigationNode UserCustomAction
Excellence in Software Engineering 5 Main objects: Data and Schema Site Web List Field ListItem FolderFile Change ContentType
Excellence in Software Engineering 6 Main objects: Logic and Security Site Web RoleDefinition RoleAssignment WorkflowAssociation WorkflowTemplate
Excellence in Software Engineering 7 Basics Batch operations Execute Query
Excellence in Software Engineering Only Foundation functionality –No search, profiles, metadata, administration No privileges elevation Requests are throttled Execution model: –.NET CLR can be sync –SL/JS are async only O365 Support Hints 8
Excellence in Software Engineering using (ClientContext ctx = new ClientContext( { FormsAuthenticationLoginInfo fbaInfo = new FormsAuthenticationLoginInfo(“user”, “pwd”); ctx.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication; ctx.FormsAuthenticationLoginInfo = fbaInfo; } Authentication Support: FBA 9
Excellence in Software Engineering using (ClientContext ctx = new ClientContext( { NetworkCredential cred = new NetworkCredential(“user”, “pwd”, “domain”); ctx.AuthenticationMode = ClientAuthenticationMode.Default; ctx.Credentials = cred; } Authentication Support: Impersonation 10
Excellence in Software Engineering 11 Anonymous Access Blocked functionality –GetItems, GetChanges on SPList –GetChanges, GetSubwebsForCurrentUser on SPWebs –GetChanges on SPSites Get it back by WebApp PS: $app.ClientCallableSettings.AnonymousRestrictedTypes. Remove([microsoft.sharepoint.splist], “GetItems”)
Excellence in Software Engineering 12 SilverLight specifics SL context from init params <param name = \”initParams\” value = \”MS.SP.url=“ + SPContext.Current.Site.Url + “\”/>” Enables ClientContext.Current
Excellence in Software Engineering 13 Cross-domain (protocol/port) access clientaccesspolicy.xml crossdomain.xml Use proxy
Excellence in Software Engineering 14 CSOM examples MySiteSync –dropbox with SP DWH builder with SSIS –import data to warehouse from SSIS Quick utilities, incl SPD –get GUIDs, etc