Discussion:
Site add customisation - feature stapling ?
(too old to reply)
Stu
2010-03-22 22:12:01 UTC
Permalink
Hi all, I am trying to find out how I can perform some simple modification to
user input when a user attempts to add a new site in WSS.

Basically, I want to check & modify the title, URL, and selected template
when a user attempts to add a new site.

Since there is no 'siteadded' or 'siteadding' event, I obviously cannot use
it, and in looking how to do this I have come accross several discussions on
'feature stapling' which looks to be how others are achieving this - am I
heading down the wrong path here? Is there a more simplistic way I can check
and edit user input before a new site is provisioned?

Any advice greatly appreciated!
Louis Saunders
2010-03-24 21:16:01 UTC
Permalink
Hi Stu,

I think you may be on the right track here. Whenever i have needed to run
some code or change some settings after a site is created i have used a
stapler. Its a bit of a confusing concept at first but to put it simply, you
have one feature that is know as the stappler that basically "whenever a site
is created with site template X, enable feature Y". The second feature is
feature Y - the feature that gets enabled when the site is created. If you
just want to run some simple code, you would have the stapler enable the
staplee feature when the site is created, so you add the code that you want
to run in the FeatureActivtated event.

One way i have used this alot is to make new sites use the parent sites
master page and css setting as i found it very annoying that this was not set
as default (new sites always use default master page and css).


Hope this makes sense, let me know if you want more info or an example :)


Lou
Post by Stu
Hi all, I am trying to find out how I can perform some simple modification to
user input when a user attempts to add a new site in WSS.
Basically, I want to check & modify the title, URL, and selected template
when a user attempts to add a new site.
Since there is no 'siteadded' or 'siteadding' event, I obviously cannot use
it, and in looking how to do this I have come accross several discussions on
'feature stapling' which looks to be how others are achieving this - am I
heading down the wrong path here? Is there a more simplistic way I can check
and edit user input before a new site is provisioned?
Any advice greatly appreciated!
Stu
2010-04-29 20:14:01 UTC
Permalink
Hi Louis, thanks for the info.

What I actually did is wrote a custom .aspx page with the code necessary to
generate a new site, and add the parent's look and feel.
It may not be the greatest coding technique in the world, but it does work :)

Next time, I'm going to go the way of stapling and see how tough it is to
get that working.

Stu.
Post by Louis Saunders
Hi Stu,
I think you may be on the right track here. Whenever i have needed to run
some code or change some settings after a site is created i have used a
stapler. Its a bit of a confusing concept at first but to put it simply, you
have one feature that is know as the stappler that basically "whenever a site
is created with site template X, enable feature Y". The second feature is
feature Y - the feature that gets enabled when the site is created. If you
just want to run some simple code, you would have the stapler enable the
staplee feature when the site is created, so you add the code that you want
to run in the FeatureActivtated event.
One way i have used this alot is to make new sites use the parent sites
master page and css setting as i found it very annoying that this was not set
as default (new sites always use default master page and css).
Hope this makes sense, let me know if you want more info or an example :)
Lou
Post by Stu
Hi all, I am trying to find out how I can perform some simple modification to
user input when a user attempts to add a new site in WSS.
Basically, I want to check & modify the title, URL, and selected template
when a user attempts to add a new site.
Since there is no 'siteadded' or 'siteadding' event, I obviously cannot use
it, and in looking how to do this I have come accross several discussions on
'feature stapling' which looks to be how others are achieving this - am I
heading down the wrong path here? Is there a more simplistic way I can check
and edit user input before a new site is provisioned?
Any advice greatly appreciated!
Loading...