Question

I'm trying to determine if there is any way to automatically deploy a few web parts on the creation of new My Sites pages, but in a manner that doesn't use feature stapling. I know how to feature staple, but if I don't have to create a .wsp just to do this it would be preferable to the client.

Is there any no-code solution to modify the default layout used by a site template? This is a publishing site if that makes a difference.

Was it helpful?

Solution

As each my "mysite" is a new site collection using a Microsoft Site Definition, there is no no-code solution for automatically adding web parts to a page. (Well there is one no-code solution: Someone could sit in central administration add refresh the list of "mysites" and when he sees a new one he could log in and add the web parts, but I think that after a few days he'll be more than happy to install a wsp instead)

Feature Stapling is definitely the way to go. WebProvisioned will not work as it can only be Site or Site Collection scoped, if it could be WebApplication scoped then it would have been a great solution.

But notice that if what you want is to add web parts to the default page on each My site, then you'll run into the problem that the page isn't created until after your stapled feature has been activated, so you can't just add the webpart in FeatureActivated, the usual trick is to add a delegate control in the stabled feature which will the activate the third feature when shown, remove itself and redirect back to the page.

Another option is to create a new welcome page as described in SP2010 "MySites" – Part Four: My Content

OTHER TIPS

rjcup,

Your client is likely not the right entity to ask what solution is best. If you're the developer, then you should know best and if your client doesn't trust your judgement, then your client has a problem much greater than how to get something done. If that client knows more about SharePoint than you do, then you have a quite different problem as well.

The right way to accomplish what you want is with a feature stapler, although there are other options. You'll end up with a WSP though, which is usually the case in anything but the simplest of development projects. If your client can't handle the thought of deploying WSPs then they have to give up on anything but the simplest of customization, and this definitely isn't on the 'simplest' list.

.b

Have you considered the WebProvisioned event handler or use simply Feature Activation event handler and activate other features. See here http://www.keirgordon.com/post/Programmatically-Activating-SharePoint-Features.aspx.

Hope it helps, C:\Marius

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top