730 likes | 1.02k Views
Welcome. 12/19 SharePoint Server 2007 技術深入探討 – 進階開發篇. 敦群數位科技有限公司 vanGene Digital Inc 游家德 Jade Yu. Agenda. Platform technical overview SharePoint Site UI Customization SharePoint Content API introduction Web Part in SharePoint Event Handling in SharePoint Feature in SharePoint.
E N D
12/19 SharePoint Server 2007 技術深入探討 – 進階開發篇 敦群數位科技有限公司 vanGene Digital Inc 游家德 Jade Yu
Agenda • Platform technical overview • SharePoint Site UI Customization • SharePoint Content API introduction • Web Part in SharePoint • Event Handling in SharePoint • Feature in SharePoint
Pictures of SharePoint Platform Business Intelligence Collaboration BusinessProcesses Portal Content Management Search Next generation e-mail, project management, workflow, blog and wiki support Server-based spreadsheets plus BI portals built on SQL Server Analysis Services Windows SharePoint Services“V3” Server-based forms and workflow with smart client and browser interfaces Enhanced SharePoint Portal aggregation and personalization Great relevance with rich people and business data search Integrated document, records and Web content management workspace foundation for scalability and extensibility
Role of WSS3.0 in SharePoint Framework Office 12 Solutions Built On WSS V3 Collaboration Portal ECM BI Search BPM Project Core Workspace Services APIs Fields/Forms OM and SOAP Events Deployment Storage Repository Metadata Versioning Backup Security Rights/Roles Pluggable Auth Per Item Rights Trimming Management Admin UX Delegation Provisioning Monitoring Topology Config Mgmt Farm Services Feature Policy Extranet Site Model Rendering Templates Navigation Visual Blueprint Operating System Services ASP.NET (Web Parts, Personalization, Master Pages, Provider Model for navigation, security, etc.) Database Workflow Search • Windows SharePoint Services V3 • Core Service platform • High level components
WSS3.0 Core Functions Data Infrastructure Object Model, Web Services, Events Document Management, Workflow Provisioning System Page and Rendering Model
WSS vs .NET Framework Windows SharePoint Services “Version 2” Windows SharePoint Services “v2” ASP.NET 1.1 ASP.NET 2.0 Windows SharePoint Services “Version 3” Windows SharePoint Services “v3”
Why move WSS3.0 to .Net20 • Goals Build more directly on top of ASP.NET Move core functionality to ASP.NET • Benefits Leverage ASP.NET skills for WSS development • More consistency, less “SharePointisms” Use more ASP.NET facilities Provide & consume more ASP.NET interfaces • Web Parts, Membership, Site Map Providers, etc.
Handling of SharePoint Request Windows SharePoint Services “Version 2” Windows SharePoint Services “Version 3”
Based on IIS Web Applications • WSS now creates its own application Does not “take over” the default app • No need for “exclusions”(排除路徑) • Unified application domains • Centralized Web configuration management object model
What do you want to customize? • List Fields / View • Cascading Style Sheets • UI Look and Feel • Workflow
Tools for Customization Office SharePoint Designer + Browser Microsoft Visual Studio Web site construction Custom Coding (if necessary) Create lists and doclibs Web Controls and Parts Design Web pages ASP.NET page coding No-code data view/forms Workflow actions No-code workflows Event handlers Web part hookup
Impacts and scope of Customization • List • Site • SiteCollection • Site Definition
Master Page of Site Definition • C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL\Master.page
Folder of CSS • C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1028\STYLES\core.css
Supports by SharePoint Designer • Use custom Master Pages for application chrome • Quick global changes • CSS tools for customizing SharePoint styles • “Core.css” automatically copied to local site • New safety nets • Users can restore original contents of site template pages, i.e. “re-ghost” pages • Versioning and Recycle Bin • “Contributor Mode” for fine-grained restrictions • Deep support for ASP.NET
Application Customization Changing the application look and feel using CSS and Master Pages
Types of Development Deliverables Data Metadata Behavior ASP.NET extensions Packaged Feature and Site Solutions
Data • Programmatic access to data and documents • Custom (or customized) lists, libraries, views Calendars / Contacts / Announcements / Links / Surveys / Discussions … • Content Migration APIs • Change logs
Metadata • Column Templates Centralized Field Management E.g., all “Priority” fields should have 3 choices: 1, 2, 3 • Content Types Reusable definition of a list schema Hierarchical Associate Behaviors • Events • Document Templates • Workflows
Behavior – Events • Before and after events • List schema events • SPWeb deletion events • Events on lists and libraries • Pre-synchronous with cancellation and filtering • Multiple event receivers • Event Receivers per-list Item • Attach events at web or item level
Behavior – Workflow • Windows Workflow Foundation is embedded • Projects Workflow activities Workflow assemblies Workflow metadata Workflow UI • Tools Visual Studio SharePoint Designer
ASP.NET Extensions • It’s never “should I use ASP.NET or SharePoint sites?,” it’s “should I use ASP.NET to write from scratch or to extend SharePoint sites?” • Web Parts • Custom controls • Custom pages • Master pages • User/role providers
Features • Combination of list/view/Web Part/Event Handler/workflow component/etc. • Can be packaged and deployed as a single set • Site Definitions are now largely sets of features • Sharable across site definitions
Site Definitions • Low-level instructions and resources for creating, rendering sites All sites are based on a site definition Created with XML and ASP.NET resources Can execute code during site creation • Whole new kinds of sites Team software development University courses Specialized project management Blogs/Wikis Activity monitors
Customization Issues: • Store Enhancements • Event Receivers • Workflows • Field Types • Content Migration • Security Policies • Site Metadata • Site Columns • Content Types • List Definitions • UI Enhancements • Web Parts • Master Pages • View Definitions • Smart Clients • SOAP • WebDAV • FrontPage RPCs • Provisioning • Site Definitions • Feature Definitions • Provisioning Assemblies
Terms of WSS3.0/MOSS2007 • Server Farm • Web Application(Virtual Server) • Site Collection(SPSite) • Site(Web)
Scenarios for using Content API • Web Page / Window Form / Console Aps. • Retrieve Data in WSS for customized use • Update Data in WSS
How to get the root object for SPSite • Web Page • SPSite oSite=SPControl.GetContextSite(httpcontext.current);or • SPSite oSite=new SPSite(“http://MOSS”)); • Non-Web Form • SPSite oSite=new SPSite(“http://MOSS”));
Codes to Get SPWeb object SPSite oSite=new SPSite(“http://MOSS”)); SPWeb oWeb=SPSite.AllWebs[“/WebURL”];
Codes to get SPLISTCollection/SPList SPSite oSite=new SPSite(“http://MOSS”)); SPWeb oWeb=SPSite.AllWebs[“/WebURL”]; SPListCollection oLists = oWeb.Lists; foreach(SPList oList in oLists) { console.write(oList.Title); }
Codes to get SPListItemCollection/SPListItem SPSite oSite=new SPSite(“http://MOSS”)); SPWeb oWeb=SPSite.AllWebs[“/WebURL”]; SPList oList = oWeb[“listname”]; foreach(SPListItem oListItem in oList.Items) { console.write(oListItem[“Title”]); }
Create a new ListItem SPSite oSite=new SPSite(“http://MOSS”)); SPWeb oWeb=SPSite.AllWebs[“/WebURL”]; oWeb.AllowUnsafeUpdate=true; SPList oList = oWeb[“listname”]; SPListItem oli = oList.Items.Add(); oli[“Field”]=“Field_value”; oli.update();
Recommendations about using API • Reduce the SQL pass through between using SharePoint Object. • Get root object as early as possible, and release as late as possible. • You should use object loaded from previous API call in memory
Sample of bad / good coding • Bad Coding oWeb.List[“name”][0][“Title”]=“new title”; oWeb.List[“name”][0][“start_date”]=“2007/7/7”; oWeb.List[“name”][0][“start_date”]=“2007/7/31”; oWeb.List[“name”][0].update();
Sample of bad / good coding • Good Coding oListItem=oWeb.List[“name”][0]; oListItem[“Title”]=“new title”; oListItem[“start_date”]=“2007/7/7”; oListItem[“End_date”]=“2007/7/31”; oListItem.update();
Using SharePoint Content API Write Console to access data in SharePoint
WebPart in SharePoint • Web Parts are now in ASP.NET 2.0 • ASP.NET 2.0 Web Parts supported • Full Compatibility for WSS “v2” Web Parts • WSS “v2” Web Part class rebased on .NET 2.0 web parts MyV2WebPart -> Microsoft.SharePoint.WebPartPages.WebPart -> Microsoft.Web.UI.WebControls.WebParts.WebPart • Improved user interface for Web Parts
Types of WebPart in SharePoint • SharePoint WebPart(WSS WebPart) • ASP.NET WebPart • Hybrid WebPart
How to implement and deploy Web Part in SharePoint • Create a WebPart Project in VS.NET 2005 • Assign Strong Name and version information • Copy Dll to bin folder and add SafeControl section in web.config • Add web part to WebPart Gallery • Add web part to WebPage Page
Implementation of WebPart Implement a “Hello World” Web Part