Print Version Email Page Add to Favorites Comments Alert Me Add to My Links

Thursday, August 28, 2008

Adding Flash Animation to SharePoint 2007 Site

Adding a flash animation (.swf) file is merely easy task.
  • Upload flash file (.swf) to Document Library. (For e.g.: wolf.swf is the file, I have uploaded to my Document Library)
  • Add a Content Editor Web Part to your page.
  • Click Source Editor.
  • Paste the following code there:


< OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"
WIDTH="550"
HEIGHT="400">

< PARAM NAME=movie VALUE="/Shared%20Documents/wolf.swf">
< PARAM NAME=WMODE VALUE="Transparent">
< PARAM NAME=quality VALUE="high">

< EMBED src="/Shared%20Documents/wolf.swf"
quality="high"
wmode="transparent"
WIDTH="550"
HEIGHT="400"
TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
< /EMBED>
< /OBJECT>

Friday, August 22, 2008

MOSS 2007 : Feature Stapling

Introduction
Recently, I came across a situation, where-in I need to apply our custom theme to sharepoint site upon creation, i.e. setting our custom theme as a default one.
We generally have to go for customizing the out of box templates. In such a case, modifying the 12 hive folder is one option, but isn’t recommended as it will render the site unsupported in case of an upgrade.

In this post, I will be demonstrating how to attach a custom feature with a site template. Feature Stapling allows to staple a Feature to a site definition without modifying it in any way. To use feature-stapling, you first need the feature(s) you wish to link to the site definition - these should be created in the normal way. Then you should create a 2nd feature which does the actual stapling.

Step 1 - Create a Sample Feature
Create a sample feature, which will be activated every time a site is created with a specified template.
  • Create a Class Library project and inherit SPFeatureReceiver class
  • Override FeatureActivated() method.
  • Strongly name the assembly.
  • Add assembly to GAC.


  • Create a folder called ACMEThemeFeature inside FEATURES folder. (%ProgramFiles%\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES)
  • Create a feature.xml file inside ACMEThemeFeature folder.


  • Run the following command to install this feature:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>stsadm -o installfeature -name ACMEThemeFeature

Step 2 - Associate a Template with Feature
After creating and installing a feature, we need to associate a template with this feature, for that purpose we will again create a feature but with scope as FARM (This is called a stapler feature).
  • Create a folder called ACMEThemeStapler inside FEATURES folder.
  • Create Feature.xml file inside ACMEThemeStapler folder.


  • Create Element.xml inside ACMEThemeStapler folder.


  • FeatureSiteTemplateAssociation ID inside Element.xml is id of the ACMEThemeFeature feature.
  • TemplateName is the teamplet name, you will get a list of TemplateName from Roadburn’s SharePoint 2007 blog.
  • Install ACMEThemeStapler feature using below command from command prompt:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>stsadm -o installfeature -name ACMEThemeStapler

Now, whenever a new site is created, ACMEThemeFeature feature will be activated and the will apply the specified theme to site.

World Clock