1 / 13

Create a SharePoint Web Part Wrapper for ASP.Net User Controls Using C

Agenda. 1.Definition of some SharePoint terms for ASP.Net developers.2.Setting up Visual Studio for SharePoint Feature Project Development.3.Setting up a solution/project for the User Control Container Web Part (CCWP) feature.4. Components for web part within Feature.5. Web Part properties for C

yasuo
Download Presentation

Create a SharePoint Web Part Wrapper for ASP.Net User Controls Using C

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. Create a SharePoint Web Part Wrapper for ASP.Net User Controls Using C# By Alex de Gaston Nov 6, 2010

    2. Agenda 1.Definition of some SharePoint terms for ASP.Net developers. 2.Setting up Visual Studio for SharePoint Feature Project Development. 3.Setting up a solution/project for the User Control Container Web Part (CCWP) feature. 4. Components for web part within Feature. 5. Web Part properties for CCWP. 6. Demonstration 7. Wish List Improvements for the CCWP. 10. Questions/Answers + Feedback

    3. Overview

    4. SharePoint Terms for .NET Developers – Part 1 SharePoint Farm – Comprised of the server(s) that make up the application and data tiers for a SharePoint installation. The application tier servers are called Web Front Ends (WFE) running as ASP.Net sites in IIS and the data tier is running SQL Server. Web Application – A farm is a collection of web applications. Each web application is a website in IIS with an application pool associated with it. Thus you can recycle one web application within a farm without impacting the other web applications or doing a reboot of any servers in case of a memory leak or other system issues. Site Collection – Each web application must contain one or more site collections. In the application programming interface (API) aka the Microsoft.SharePoint namespaces is a class definition called SPSite that corresponds with a Site Collection. Each Site Collection has its own content database. This means you can port a site collection between farms and do backups/restores separately on each standard site collection. Site - A site collection contains one or more sites. In the API is a class definition called SpWeb that corresponds with a SharePoint site. It’s important that any SPWeb object you instantiate have its Dispose() method called upon termination or else resources won’t be freed and you’ll have a memory leak. OOTB - Out of the buy vs. build debate in the IT industry has come the concept of robust solutions such as TFS providing plenty of “out of the box” (OOTB) capability which can handle closely (or sometimes precisely) what the customer wants. Why pay/wait to have a capability custom built if you can have it OOTB now with just some minor tweaks?

    5. SharePoint Terms for .NET Developers – Part 2 WSP – Windows SharePoint Services (WSS) Solution Packages are commonly referred to as WSPs. They are much like a .MSI or .CAB file and used by SharePoint administration utilities such as Power Shell or stsadm to be deployed/configured on a SharePoint farm. “14 Hive” – On each WFE is a directory called the “14 Hive” in SharePoint 2010 where application/configuration artifacts are installed for use by SharePoint when you deploy a WSP. In SharePoint 2003 and 2007 the directory was called the “12 Hive”. Feature – In the past SharePoint architects/administrators would oftentimes convert their SharePoint sites into Site Templates in order to reuse functionality. The trend is more towards using vanilla site definitions with Feature(s) to perform functionality beyond the vanilla OOTB capabilities for a site. A Feature is a collection of artifacts relative-referenced by a single Feature.Xml file within the Feature’s folder in the “14 Hive”. Feature Receiver – An attribute in the Feature.Xml file references a .NET class that deploys with the WSP. This .NET class contains event handlers that get called when the feature is installed, activated, deactivated, and uninstalled. As a general rule you should not write any custom code for the installed/uninstalled events and the code you write in the activated/deactivated event handlers should be very safe and in a try-catch clause that’s certain to not let any exceptions get out-of-scope. The purpose of the Feature Receiver is to allow for automated configuration of the solution’s components and functionality upon activation and cleanup upon deactivation.

    6. SharePoint Terms for .NET Developers – Part 3 Web Part – A web widget or server control in a SharePoint ASP.Net page that’s added to a Web Part Zone for users at runtime. Web parts contain custom properties that can be modified by end users for look/feel, content, and behavior. User Control – A component on an ASP.Net page that is a kind of composite control that works much like a page except that its meant to be embedded into an existing page per the layout requirements of its host page. For SharePoint the user controls are deployed into the controltemplates folder tree under the “14 Hive”. Application Page – SharePoint application pages are ASP.Net web pages that have certain requirements above/beyond regular ASP.Net pages. First, they must use a SharePoint ASP.Net Master Page. Second, their codebehind partial class (if available) must be inherited from a defined SharePoint subclass of System.Web.UI.Page. Finally, the .aspx file must be deployed to the layouts folder tree in the “14 Hive”.

    7. 2.Setting up Visual Studio for SharePoint Feature Project Development. Install/configure a Virtual Machine with Windows Server. Install/configure SQL Server + SharePoint farm. Install Visual Studio. Install WSPBuilder.

    8. 3.Setting up a solution/project for the User Control Container Web Part (CCWP) feature.

    9. 4. Components for web part within Feature.

    10. 5.Web Part properties for CCWP

    11. 6. Demonstration Overview of Solution Code. ControlContainerWebPart (CCWP) class. BaseUserControl class. Example User Control class. Compiling and Deploying Using WSPBuilder. Edit Web Part Page to add CCWP. Configure CCWP for example User Control. User Control custom properties in CCWP. Rapid prototyping and deploying of user control changes in test environment.

    12. 7. Wish List Improvements for the CCWP User-friendly editing of User Control custom properties in the CCWP’s User Control properties value XML. This would be accessible as an application page called from a menu link under Site Actions. A Solution Store capability where a Site Owner can select a menu link under Site Actions to add a Web Part or a more complex application to the in-context page. This would involve searching a configured list + the web part gallery + gallery of user controls in the controltemplate folders of the 14-hive to pick and add a solution. Various validation, logging, security enforcement and exception handling options to provide a more robust user experience for end users, site owners and farm administrators. Suggestions??

    13. Sites to Bookmark http://msdn.microsoft.com/en-us/sharepoint/default.aspx http://www.criticalpathtraining.com/Instructors/Pages http://www.SharePointSaturday.org http://www.codeplex.com/site/search?query=SharePoint http://alex-share.blogspot.com http://www.tinyurl.com/develop2010 http://www.tinyurl.com/alm2010

    14. Questions/Answers Presenter Contact Information: Alex de Gaston http://www.degaston.com Email: alex_degaston@yahoo.com Tel. 801-362-0393

More Related