Monday, May 05, 2008

A Lookup to the sub sites

A question from the forums:
"I'm creating a WSS 3 site which will have a new subsite each time there is a planning application.
From the parent site I want to be able to enter documents and say which application it belongs to but I don't want the user to have to maintain a list of application names when they could just lookup to a list of all the Application subsites that have been created.
Does anyone know if that's possible?

My Answer:
This is not possible out of the box (unless you use the SiteDirectory template, and create the application sites' there).

To code it, here are several options:

  1. either connect a workflow or an event handler to a list of applications, and the workflow\event handler can create the site for you.
  2. Develop a custom field control that will load the list of sub sites for the user.
    This should be more robust than option 1, since a workflow\event handler may fail to create the site and you will end up with a mess. however, custom field controls are not supported by office - so you will not be able to set the metadata on documents from within the office applications.
  3. Develop a timer job that synchronizes the list of sites into a choice field as choices.
    This will be robust, and will work in office - but will put a load on the server
  4. RECOMMENDED: develop a feature for the application sites that will add the name of the site to a list when the feature is activated.
    This will be better than option 1 because you can trigger it again if it fails, without re-creating the site. Also it will have much less load on the server than option 3, and better performance than option 2 since it will not have to check the sites every time someone wants to upload a document. Also - easy development.
  5. Develop a BDC application (using a custom web service) to show the list of applications based on the existing sites.
    This may be the second easiest option (after #4) - such a web service is easy to develop. But this will only work if you have MOSS license, as the BDC is not part of WSS.

No comments: