Sharepoint: is iterating through all children?

I need to create a function that will iterate through all the child elements of a site collection and add some sample content to each one (sample content = new pages, images, documents, maybe some lists). There is a solution that uses recursion to scroll through sites (can be found here ).

So I ask:

  • Have any of you implemented something similar, maybe in a different way?
  • What was the performance of such an iteration?

I can't tell you how many sub-sites can be present in a site collection as this feature should be used in more projects. But I think that the number of sub-sites should not exceed 100 or more.

+1


source to share


3 answers


This is a very common method for looping sites and web parts.

Speed ​​with 100 sub-sites won't be an issue. This is very fast if you do a lot of processing, which can slow it down.



The only thing to look out for is deleting items, if you leave it open or close you can suck all the memory from the WFE, especially if many 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 a utility tool http://blogs.msdn.com/sharepoint/archive/2008/11/12/announcing-spdisposecheck- tool-for-sharepoint-developers.aspx

+2


source


You can see the answer I gave to this . I think I have used the correct templates for this piece of code.



0


source


If you need to make a read-only loop through a large structure, here's a cool but slightly unconventional way:

http://hristopavlov.wordpress.com/2008/10/20/a-very-fast-method-to-get-the-site-collections-web-structure/

0


source







All Articles