share point development 101

32
SharePoint Development 101 St. Louis Metro East .NET User Group June 17, 2014 Becky Bertram Owner, Savvy Technical Solutions www.savvytechnicalsolutions.com @beckybertram

Upload: beckybertram

Post on 28-Nov-2014

157 views

Category:

Software


3 download

DESCRIPTION

In introduction to the various SharePoint development techniques in SharePoint 2013, this slide deck will give new SharePoint developers an overview of the options available to them to develop against SharePoint. To view audio of this recording go to the Office Mix version at https://mix.office.com/watch/1bgqd4roxtwpe

TRANSCRIPT

  • 1. SharePoint Development 101 St. Louis Metro East .NET User Group June 17, 2014 Becky Bertram Owner, Savvy Technical Solutions www.savvytechnicalsolutions.com @beckybertram

2. About Me Owner of Savvy Technical Solutions in OFallon, IL 5 time SharePoint MVP Co-author of Wrox SharePoint Six-in-One Co-author of several Microsoft exams Instructor at CAIT @ Wash U Started working with MS CMS in 2001, SharePoint in 2006 Wife of Ryan, mother of Lilly and Abby (3 and 1 years) Hobbies: sleeping and showering 3. Flavors of SharePoint SharePoint Team Services (STS) and SharePoint Portal Server (SPS) Windows SharePoint Services (2.0 and 3.0) and Microsoft Office SharePoint Server 2007 (MOSS) SharePoint Foundation 2010 and SharePoint Server 2010 SharePoint Foundation 2013 and SharePoint Server 2013 ----------------- BPOS SharePoint Online (part of Office 365) 4. What is SharePoint? Web-based too for building intranet, extranet, or internet applications Allows users to quickly spin up sites, manage documents, search for content Enterprise tools for managing external content, business processes, external data, etc. Social and collaborative tool to encourage teams to work together toward common goals Enterprise search engine, document preview, etc. Front-end for other MS products, such as SSRS, Project, etc. Bottom line: platform more than a product, a tool belt full of tools you get to choose from to build your application 5. Making Changes to SharePoint Configuration Customization Development 6. Configuration Configuring application features: Setting up Service Applications such as Search, BCS, Managed Metadata, etc. Done with Central Admin or PowerShell Configuring Web Parts: Setting web part properties so they demonstrate the proper behavior Done with SharePoint Designer (SPD) or through the browser 7. Customization Content stored in the content DB Application files on WFE servers SP uses app files on server to serve as templates Customization is when you deviate from the template and SP stores the changed version in the content DB Customization usually done in SPD 8. Development Implies the use of development tools such as Visual Studio Code-based applications that are file- based and can be checked into source control Changes can be deployed via solution packages or as SharePoint apps to multiple environments 9. Visual Studio SharePoint Templates 10. SharePoint App Template 11. Wheres Workflow? Workflow no longer part of available VS templates WF now declarative in SP. Custom workflows run in WM. If you need to access custom workflow logic, you can even write a web service to call out to. Since WF is now just an XML node, can be added as an item to a regular SP project. 12. Remote Event Receiver An event receiver is code that fires when an activity happens such as a web site is created or deleted, an item is added or deleted from a list or library, etc. Legacy event handlers deployed within assemblies in farm solutions Remote event receivers are exposed web services that SharePoint calls when the event happens. Your custom code can then use CSOM if it needs to access SP data, or it can act on external LOB data. 13. VS Project Items 14. Solution Packages A CAB file with a WSP extension Solution Manifest is an XML file that gives SP instructions about what to do with files in the package Packages typically contain: Flat files to be installed in the SharePoint installation directory on the WFE Assemblies to be put in the GAC Instructions about content to be added to a content DB Controls to be marked as safe in the web.config 15. Feature A unit a functionality than can be implemented at the farm, web application, site collection, or site level Can execute code and/or add something to the content databases. Examples: add a master page and CSS to the top level site, add a content type or site column to the site collection, add a list definition or list instance to your site; kick off a timer job; add a link to the ribbon or the site settings page. 16. Farm Solution Solution package deployed within a SP farm. Can be deployed to a particular web application within SP. (Web app typically connected w/ one or more IIS web sites.) Gracefully handles added servers to the farm Files deployed to file system; assemblies (typically) deployed in GAC; code executes in web server process (W3WP.exe) Deprecated 17. Sandboxed Solutions Code executes in a separate (sandboxed) worker process If too many resources used, can be shut down. Prevents unintended consequences in multi-tenant environment. Solutions uploaded by site collection admins Server resource throttling handled by farm admins (Mostly) deprecated Uses SSOM with restrictions (cant access objects above site collection level, cant elevate permissions) 18. Server-Side Object Model SharePoint managed (i.e. .NET) assemblies contain SharePoint API Assemblies installed on the SharePoint WFE, ergo development must take place on a SharePoint server (usually VM) This approach is deprecated, but none of the APIs themselves have been deprecated. 19. SSOM code example using Microsoft.SharePoint; using(SPSite site = new SPSite("http://intranet")) { using(SPWeb web = site.OpenWeb(deprtments/hr")) { using(SPWeb root = site) { ... } } } 20. Client-side Object Model Microsoft-sanctioned way of accessing data and functionality inside SharePoint server from outside SharePoint (i.e. on a client). Means no custom code running on SharePoint server except what has been sanctioned by MS to work via their object model The future OM augmented all the time to get parity with older SSOM 21. Managed Code CSOM .NET assemblies that can run on a non- SharePoint server to access data inside SharePoint Windows app Test jigs Data import Exposed web services Etc SharePoint apps Externally hosted web sites 22. ECMA Script CSOM (Pretty much JavaScript) way of accessing data inside SharePoint from a web page Web page can be hosted in SharePoint, or hosted outside SharePoint (perhaps on a SharePoint App page) Reference JS library such as sp.core.js and sp.core.debug.js) Can be used with Jquery or AJAX libraries 23. CSOM Example function retrieveWebSiteProperties(siteUrl) { var clientContext = new SP.ClientContext(siteUrl); this.oWebsite = clientContext.get_web(); clientContext.load(this.oWebsite, 'Title', 'Created'); clientContext.executeQueryAsync( Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed) ); } function onQuerySucceeded(sender, args) { alert('Title: ' + this.oWebsite.get_title() + ' Created: ' + this.oWebsite.get_created()); } function onQueryFailed(sender, args) { alert('Request failed. ' + args.get_message() + 'n' + args.get_stackTrace()); } 24. ODATA and REST Way of accessing data within SharePoint using a URL, and HTTP Request and Response objects Handled by client.svc web service in SP, aliased with _api. To access site data, use the site URL followed by _api, such as http://intranet/hr/_api Append which object you want to work with after the _api, such as /site, /web, or /lists, such as: http://intranet/hr/_api/lists/getbytitle(employees') 25. ODATA and REST Contd Use HTTP commands to carry out CRUD operations: POST (Create) GET (Read) MERGE or PUT (Update) DELETE Results returned using JSON or ATOM Very fast response. Useful for autocomplete, etc. 26. Using ODATA with JS function getListItem(url, listname, id, complete, failure) { $.ajax({ url: url + "/_api/lists/getbytitle('" + listname + "')/items(" + id + ")", method: "GET", headers: { "Accept": "application/json; odata=verbose" }, success: function (data) { complete(data); }, error: function (data) { failure(data); } }); } } 27. SharePoint Web Services API Deprecated way of accessing SharePoint Stored in _vti_bin: http://Site/_vti_bin/Lists.asmx However, fairly robust. Using SPServices, can use SP Web Services API as JQuery on the client (SPServices.codeplex.com) 28. SPServices Example

29. SharePoint App Model Much like the concept of an app store for your phone or tablet Office Store is for publicly sold apps Corporate Catalog is for apps you create and load just in your farm Goal is for ZERO custom code to run inside the SP environment 30. App Locations Host Web: Location where app is installed. Web from which a user navigates to app Can contain an App Part, which to user feels like a web part, but is actually an IFrame to a page in your app. App web: Location of your actual app. Provider-hosted: located OUTSIDE of SP SharePoint-hosted: located in a subsite (with a different URL). Still no server-side code Can be the same or unique 31. Napa Napa app is a web-based tool for generating apps on the fly in your Office 365 developer site 32. Questions?