forge

SPSiteDefUpd – SharePoint Site Definition Update

I’ve mentioned through the last few posts that I’m working on another custom site definition and that I’m wandering through SCHEMA.XML definitions.  Well, one of the things that I decided to do since making changes to Schema definition file is so monotonous is to automate the addition or removal of web parts in all of the appropriate schema.xml files within a site definition.

So I have yet another tool… SPSiteDefUpd — it updates site definitions to add, remove, or enumerate web parts in the various schema.xml files for the list definitions under a site definition.  It has a few limitations …

Help Your SharePoint User
  • Right now it only processes the List defintions, it won’t automatically update your ONET.XML file to — that would be handy if you’re adding something like a global header or footer.  (but modifing the ONET is substantially quicker than hitting all of the schema.xml files.
  • It does removal by title so if you have two web parts with the same name .. it will remove one of them but which one it will remove is a mystery.  (Actually, it’s not, it will remove the first one listed in the Schema.xml file.)
  • It won’t touch the ListForm or ListView web parts — this is in no small part due to the fact that they don’t actually show up in the web parts section.

OK, now that you know what it won’t do, here’s what it does do:

  • Processes every file for the list definition.  This includes both views and forms.
  • Processes every list definition — you tell it where the site definition is and it will, if you want, go through and do replacements for every list definition — or for only one if you prefer.
  • Adds new web parts — it reads the web part zone and web part order to put in the AllUsersWebPart attributes.
  • Adds the WebParts node to the XML if it doesn’t exist.
  • Enumerates all web parts on every page in every list definition or any subset that you prefer.
  • Removes web parts from the site definition by title.
  • Consolidates write operations if multiple sections of the file are changed to improve performance.

I think it will be very handy as I work on new site definitions and want to do a quick add of my global header, footer, and navigation.  It will be trivial to get these pushed through all of the pages now.  It will also be good since I will be able to allow clients to create their own new site definitions based on a site definition that I leave with them.

If anyone else is interested in trying the tool out let me know via feedback or comment, I’ll be looking for a few beta testers by the end of the week. (That will give me time to write the documentation and do a bit more testing.)

1 reply

Comments are closed.