Packaging Your Advanced SharePoint Customizations - PowerPoint PPT Presentation

About This Presentation
Title:

Packaging Your Advanced SharePoint Customizations

Description:

At its core, a solution pushes files around. The File Bus ... Most common is Devs can't touch Prod. Other Interesting Approaches. Manually Deploy across a Farm ... – PowerPoint PPT presentation

Number of Views:19
Avg rating:3.0/5.0
Slides: 42
Provided by: erikr155
Category:

less

Transcript and Presenter's Notes

Title: Packaging Your Advanced SharePoint Customizations


1
Packaging Your Advanced SharePoint Customizations
  • Neil Iversen
  • Inetium
  • http//justaddcode.com

2
Solution Basics
  • At its core, a solution pushes files around
  • The File Bus of SharePoint
  • Farm Safe Works across Front Ends
  • Deployed to the Farm

3
Solution Life Cycle High Level
4
Features
  • Deployable unit of functionality
  • Used to customize SharePoint
  • Extensively used by SharePoint itself
  • Stored in the Hive
  • 12\TEMPLATE\FEATURES
  • Each feature in its own directory

5
Feature Lifecycle
6
Types of Features
  • Content Type
  • Custom Action
  • Delegate Controls
  • Events
  • Feature Stapling
  • Field
  • Lists (Templates and Instances)
  • Module
  • Workflow

7
Why do I need this fancy packaging?
  • You need something that isnt available in the
    OOB Features
  • The OOB Features do/dont do something you need
  • You are deploying something outside of SharePoint
  • And you still care about change control

8
  • Individual Developer Environments
  • Developers build functionality into
    features/solutions

9
Feature Receivers
  • Executes code when the state changes
  • Key to our ability to make drastic changes
  • If you can code it you can do it
  • Allows for extremely powerful code to get added
  • While still being easily deployable
  • Overrides
  • FeatureInstalled, FeatureUninstalling
  • FeatureActivated, FeatureDeactivating
  • Example
  • ltFeature Id"0a7e1ca9-ee71-4407-80a0-b5b57f4f6f5d"
  • TitleMy Feature Reciever"
  • Scope"Site"
  • ReceiverAssemblyMyAssembly, Version1.0.0.0,
    Cultureneutral, PublicKeyTokene35a4d2663eae0ae"
    ReceiverClassMyAssembly.MyFeatureReciever"
  • xmlns"http//schemas.microsoft.com/sharepoint/"gt

10
Feature Receivers Getting Context
  • Getting Context
  • Retrieving the Current Scoped Object
  • SPFeatureReceiverProperties
  • SPFeatureReceiverProperties.Feature.Parent
  • Cast to the appropriate type
  • Scope Web
  • SPWeb web (SPWeb)properties.Feature.Parent
  • SPSite site (SPSite)properties.Feature.Parent

11
Scopes
  • Farm
  • Web App
  • Site
  • Web

Database
http//sitecollection
http//external
http//sitecollection/deptA
http//external/clientA
http//sitecollection/deptB
12
Demo Our first Custom Feature
13
Feature Receivers - Debugging
  • Based on Deployment/Activation Method
  • Stsadm
  • Runs as currently logged in user
  • Debug/Console.WriteLine
  • System.Diagnostics.Debugger.Launch()
  • Web Interface
  • Runs as App Pool user
  • Need to use logger (EventLog, or some Logging
    code)
  • Attach to w3wp.exe
  • DLL Deployment
  • Overwrite Existing DLL
  • iisreset
  • stsadm o activatefeature -force

14
Testing Your Code
  • Unit Testing Features
  • Pretty straight forward if you Develop on a
    SharePoint environment
  • Probably want to ignore your abstraction
    violations (SharePoint mocks are tough)
  • Always test Farm/Scope safety
  • Need a multi server environment
  • Can you make it part of your build?

15
Feature Object Model
  • SPFarm.FeatureDefinitions
  • SPSite.Features
  • SPWeb.Features
  • SPFeature
  • SPFeatureDefinition

16
Demo Exploring the Feature OM
17
Feature Properties
  • Configuration for your Feature
  • Allow different values for Dev/Test/Prod
  • Combine with scoped property bags to set
    configurations
  • Example
  • ltPropertiesgt
  • ltProperty KeyMyKey" Value123" /gt
  • ltProperty KeyDBServer" Valueprodsql001" /gt
  • lt/Propertiesgt

18
Demo Working with Properties
19
Manually Activating Features
  • Why?
  • Evade chaining restrictions (at your own peril)
  • Working with Hidden Features
  • Manage Stages of a Site with a Web Part
  • Creating a Suicide Feature

20
Manually Activating a Feature
  • Get your Context
  • Ex SPWeb
  • Find the Feature Collection
  • Ex SPWeb.Features
  • Find the Features Guid
  • Ex Guid featureGuid new Guid(0a7e1ca9-ee71-440
    7-80a0-b5b57f4f6f5d)
  • Activate!
  • Ex SPWeb.Features.Add(featureGuid)

21
Demo Manually Activating Features
22
Feature Properties
  • Configuration for your Feature
  • Allow different values for Dev/Test/Prod
  • Combine with scoped property bags to set
    configurations
  • Example
  • ltPropertiesgt
  • ltProperty KeyMyKey" Value123" /gt
  • ltProperty KeyDBServer" Valueprodsql001" /gt
  • lt/Propertiesgt

23
Demo Working with Properties
24
Dependencies and Features
  • Your Feature might need to assume another feature
    is already active
  • Make several smaller features, then wrap them
    into a single feature that is dependant on them
  • Dependencies can only be one level deep
  • Example
  • ltActivationDependenciesgt
  • ltActivationDependency FeatureId"52890518-036f-
    4027-babd-f4c7df3ee429" /gt
  • ltActivationDependency FeatureId"6d276cfc-1c84-
    46cc-8566-500e66213e06 " /gt
  • lt/ActivationDependenciesgt

25
Dependency Limitations
  • Feature Chains
  • Limited to one visible feature
  • Dependencies cant be triggered at a higher scope
  • Ex Farm Feature cant depend on a Web Feature
  • Features cant be automatically activated at
    different scopes
  • Ex Web Feature cant activate a Farm Feature

26
Feature Dependency
Parent
Dependant
Web Site App Farm
Web
Site
App
Farm
27
(No Transcript)
28
Hidden Feature
29
Hidden Feature Activate Child
1.
2.
30
Hidden Feature - Deactivate
2.
1.
31
Hidden Feature - Deactivate
3.
1.
2.
32
Demo Dependencies are Tasty!
33
Putting it Together
  • Problem Modifying the web.config in a Farm Safe
    manner
  • Solution SPWebConfigModification and Features
  • SPWebConfigModification is Farm Safe
  • Scoping does become an issuee

34
  • Not for the faint of heart!

35
Demo Farm Safe Web.config
36
Getting a little crazy
  • What about non-SharePoint assets?
  • Databases, other web sites,
  • Is there an advantage?
  • Depends on reason for creating the Feature
  • Most common is Devs cant touch Prod

37
Other Interesting Approaches
  • Manually Deploy across a Farm
  • Create your own Timer Jobs
  • Manually add them to the different WFEs
  • PowerShell Feature
  • Execute PowerShell via a Feature
  • PowerShell v2 Scripts
  • Has ability to execute remote commands

38
Demo Deploying SQL Components
39
Your Feedback is Important
  • Please fill out a session evaluation form and
    either put them in the basket near the exit or
    drop them off at the conference registration
    desk.
  • Thank you!

40
Questions?
41
Thanks!
  • Neil Iversen
  • Inetium
  • http//justaddcode.com
Write a Comment
User Comments (0)
About PowerShow.com