R – Sharepoint: is performance of iteration through all subsites bearable

sharepointsharepoint-api

I need to create feature which will iterate through all subsites of site collection and add some sample content to each of them (sample content=new pages,images,documents,possibly some lists). There is solution that uses recursion to loop through sites (it can be found here).

So i'm asking:

  1. Did any of you implemented something similar, maybe in different way?
  2. What was the performance of such iteration?

I can't really say how many subsites can be present in site collection, since this feature should be used in more projects. But i guess the number of subsites shouldn't excess 100 or such.

Best Answer

That is a very common method of performing looping of sites and web parts.

Speed with 100 sub-sites will not be a problem. It is really quick, if you do alot of processing that can slow it down.

The one thing to watch is the disposal of items if you leave the open or don't close you can suck all the memory from the WFE, especially if alot of users reload the page at the same time. See http://www.sharepointnutsandbolts.com/2008/06/disposing-sharepoint-objects-what-they.html and http://blogs.msdn.com/rogerla/archive/2008/02/12/sharepoint-2007-and-wss-3-0-dispose-patterns-by-example.aspx for examples they also have the disposal tool at http://blogs.msdn.com/sharepoint/archive/2008/11/12/announcing-spdisposecheck-tool-for-sharepoint-developers.aspx

Related Topic