• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Share Point Web Parts 101
 

Share Point Web Parts 101

on

  • 3,475 views

SharePoint is being rapidly adopted by enterprises large and small as a platform for collaboration. One of the reasons for this rapid adoption is it's ability to be customized through the development ...

SharePoint is being rapidly adopted by enterprises large and small as a platform for collaboration. One of the reasons for this rapid adoption is it's ability to be customized through the development of custom Web Parts. This session will take ASP.Net programmers through all of the steps needed to create a custom Web Part from scratch and make it available to Site creators in their SharePoint environment.

Statistics

Views

Total Views
3,475
Views on SlideShare
3,464
Embed Views
11

Actions

Likes
3
Downloads
0
Comments
0

2 Embeds 11

http://www.slideshare.net 10
http://www.sharepointdesigngallery.com 1

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Share Point Web Parts 101 Share Point Web Parts 101 Presentation Transcript

    • SharePoint Web Parts 101Silicon Valley Code Camp 2009October 3, 2009 Joseph Ackerman, Senior ConsultantMicrosoft Consulting Services, GICS, Dell Inc.joseph_ackerman@dell.comSpecial thanks to Shawn Parker for his assistance with this presentation
    • The Ever-Popular Intro Slide
      Joseph Ackerman (joseph_ackerman@dell.com)
      20 + years of software development for clients of all sizes and shapes
      Wells Fargo
      Hewlett-Packard
      Aetna
      Visa
      Stanford University
      Currently consulting as part of Dell’s Microsoft Consulting Services
      Formerly Allin, Microsoft’s Northwest Region Partner of the Year 2008
      Most recent project: internal systems for eBay
    • Agenda
      Why are we talking about this?
      User Controls, Server Controls and Web Parts
      The Steps
      Deployment Choices
      The Future
      Resources
      DELL CONFIDENTIAL
      3
    • Why are we talking about this?
      SharePoint adoption has exploded over the last couple of years
      Programmers and Software developers are often presented with the “opportunity” to work with SharePoint because someone in the business (frequently a non-technical person) has made that decision for them
      If you work in an IT environment that runs on Windows Servers, the chances are pretty good that someone in your organization is already running SharePoint
      Bottom Line: it’s probably out there already whether you like it or not – but we all like to work, especially in today’s economic climate, right?
      DELL CONFIDENTIAL
      4
    • User Controls
      Made up of HTML/ASP page fragments
      Maybe some code behind
      Great for breaking up functionality within an application
      Not very portable, hard to re-use
      DELL CONFIDENTIAL
      5
    • Server Controls
      Harder to write
      UI elements must be built in code
      Easier to use across multiple applications
      DELL CONFIDENTIAL
      6
    • Web Parts
      Similar to Server Controls
      Different inheritance tree
      Some additional requirements for development, deployment and use
      DELL CONFIDENTIAL
      7
    • Types of Web Parts
      ASP.Net Web Parts
      This is what we will build in our demo today
      Can be used on ASP.Net and SharePoint pages
      We’re going to do it from scratch, even though there are some helpful add-on tools
      SharePoint Web Parts
      Used in SP 2003; for 2007, DON’T.
      Data Web Parts
      Built in; use XSLT to display a data source
      User Controls wrapped in SmartPart (see CodePlex)
      Just a wrapper that allows UserControls to behave like web parts
      Not very secure, Poor performance
      DELL CONFIDENTIAL
      8
    • The Steps
      Create a new project (C# windows class library)
      Sign the assembly
      References (System.web and Microsoft.SharePoint)
      Update assemblyinfo.cs (for anonymous users)
      Update web.config with Safecontrol
      Update/Create the web part classes
      Update/Create “.webpart” files
      Build and Deploy
      DELL CONFIDENTIAL
      9
    • 1. Create a new project
      C# Class Library project
      I love VB too, but do yourself a favor and use C# instead – SharePoint is not CLS compliant
      DELL CONFIDENTIAL
      10
    • 2. Sign the Assembly
      It’s all about trust
      Allows you to create a strong name for your assembly
      DELL CONFIDENTIAL
      11
    • 3. Set Your References
      System.Web
      Microsoft.SharePoint
      DELL CONFIDENTIAL
      12
    • 4. Update assemblyinfo.cs
      Add a reference to System.Security
      Allow anonymous users by adding an attribute containing AllowPartiallyTrustedCallers()
      It’s good practice to put your Public Key Token in here as a comment
      DELL CONFIDENTIAL
      13
    • 5. Update web.config
      Add your assembly to the SafeControls list
      Use the full, four-part name
      DLL name (without extension)
      Version number
      Culture
      Namespace
      Add the TypeName
      For only one class, use the name
      For all classes in the namespace, use *
      Safe should equal “true”
      DELL CONFIDENTIAL
      14
    • 6. Create your web part classes
      Your functionality goes here
      Pick your output method
      CreateChildControls()
      Add controls to the web part control collection
      Render()
      Add HTML to the HTMLTextWriter object parameter
      DELL CONFIDENTIAL
      15
    • 7. Create your .webpart (xml) file
      Only if you are deploying to the bin folder of your site
      If you are deploying to the GAC, this is not necessary
      Where can you find an example of the format?
      In the web part gallery
      DELL CONFIDENTIAL
      16
    • 8. Build and Deploy
      If you are copying your .dll to the GAC, don’t forget to run IISRESET /Restart on your web server
      If you are deploying directly to your web site, make sure that you DLL is in the /bin folder and the .webpart file is in the /wpcatalog folder
      Both are just off the root of your web site
      DELL CONFIDENTIAL
      17
    • Best Practices
      Runtime performance is more important than quick-n-easy development
      Learn to write real web parts, don’t depend on the SmartPart wrapper
      Common “Base” web part
      SharePoint object disposal
      Single-purpose parts and logic
      Consistent deployment model
      DELL CONFIDENTIAL
      18
    • Resources
      Web Parts Resource Center
      http://msdn.microsoft.com/en-us/sharepoint/bb851483.aspx
      Instructional Video, Module 2: web parts
      http://www.microsoft.com/winme/0901/34867/mod2/index.html
      DELL CONFIDENTIAL
      19
    • Questions?
      DELL CONFIDENTIAL
      20
    • www.dell.com