Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

General Feature question

  Asked By: Ashu    Date: Jan 01    Category: Sharepoint    Views: 707

We programmatically create sites based from a custom site definition.
The site definition has a few custom web parts on it. We have a ton of
sites out there, and now we want to add another web part (that we just
created) to each site. We want the part to show up on the page
automatically, meaning we do not want to go in to each exisiting site
and add the part manually. Is this possible? Is this something we could
do with a feature? From my understanding, when you activate a feature
it will add the web parts to the list of parts that are available, it
will not add them to each page. Is this correct?

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Kristy Hicks     Answered On: Jan 01

Normally adding a webpart as a feature  will just add  it to the Gallery
list of available  webparts. However, you normally add it to the
default.aspx page  by using a module section in the ONET.xml. You can
also do a Module section for a Feature. There are three possible
approaches that I would test.

First, you could add a <Module> element like the one in your custom  site
definition but with the additional ListView Webpart included. Deploying
this would overwrite the existing default.aspx file in your site  with
the new one. If the file has been changed with SharePoint Designer this
either will have no effect or will reset the page to the site definition
and lose all Designer created customizations. Not sure which, but I
suspect it will be the later.

Second, you could add a <Module> element but point it at the exisiting
default.aspx and simply add the new webpart. Interaction with pages
modified using Designer would have to be tested as with #1.

Third, you could add an assembly receiver (code dll) to the feature that
would run on activation and add the webpart to the default page
programmatically. This would be the most work, but would theoretically
handle pages that had been modified in designer all. The code would be
a Feature event handler.

Theoretically, any of these approaches should work. But I haven't tried
them.

 
Answer #2    Answered By: Alisha Itagi     Answered On: Jan 01

It looks like a very tricky solution,
no matter which way I approach it.

 
Didn't find what you were looking for? Find more on General Feature question Or get search suggestion and latest updates.




Tagged: