Kye
Kye

Reputation: 6239

Updating SharePoint sites through the onet.xml file

I've updated a site definition in the SharePoint onet.xml file so new sites are created without a particular web page on a page.

However I've read that the onet.xml file is only read when a site is first created.

Is there some way for me to get the existing sites to refresh??

It's not really partical to loop through each site and make the change.. even through code.

Upvotes: 0

Views: 1512

Answers (3)

Janis Veinbergs
Janis Veinbergs

Reputation: 6988

Do not modify onet.xml as this file can be overwritten when updating sharepoint!

And looping throught SPSite.AllWebs is not really impractical if you want to update SPWeb. Ofcourse, it would be impractical if you run this code each time item or whatever changes, but if you just need to fire this code once in a while, then this is no problem.

Oh right, but it may be a problem if you add new webs. Well, Kusek already provided you with an answer:

Another alternate you could do is that you can create a Feature that will Provision web page file and activate it in each of the web.

That's called feature stapling. Activate your feature when web has created and do your modifications for that web.

Upvotes: 1

Kusek
Kusek

Reputation: 5384

There is no other option to synchronize the changes made to onet.xml to be reflected in the existing site that are created based on the onet.xml.

  1. Loop through each of the site & create the Page is the option you are left with.
  2. Another alternate you could do is that you can create a Feature that will Provision web page file and activate it in each of the web.
  3. Finally one option I could think of is to place the page in _Layouts (If you are really against both the above options)

Upvotes: 1

ArjanP
ArjanP

Reputation: 2172

I'd think looping through every site from code is very practical? Doing it manually might not be.

You might not even have to code for it if you install the stsadm extensions. You can delete items using this command for instance and it has commands to enumerate sites with.

Upvotes: 1

Related Questions