Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm trying to generate a sitemap for my public facing SharePoint 2010 sites. I've basically found 2 approaches, the first, you grab the root SiteMapNode and then go from there. The other approach is to grab the root Web, get the publishing pages, then navigate through the web hierarchy. There are advantages and disadvantages to both, for instance method 1 is including non-publishing content, which we like, but it isn't obvious how I might check to see if a page is published. Method 2 is missing static HTML that method 1 doesn't, but I can check if the page is published, and it takes TONS less memory.

Is one "better" than the other? Pursuing option 1 first I've tried everything I can think of to reduce memory usage, eliminating recursion, etc. For GOOD examples of what I'm doing you can look at the Waldek Mastykarz's blog for option 1, and one that was suggested to me by our Microsoft rep as option 2.

One thing to keep in mind for my personal situation, I have like a gazillion subsites, each with several pages, ok, maybe that's a slight exaggeration, but I do have over 2300 subsites and 16000+ pages. I've run SPDispose tool and it says I'm all clean, but I'm basically chewing up something like 5 gig of ram to generate a sub-1 MB xml file, and I've no idea what is doing it.


share|improve this question
Well hey, for anyone else out there stumbling up against this, option 2 seems to be working fine, I adapted the code that I linked to, adding a check to see if the Indexing Mode wasn't "Never" in addition to the published date check to keep things out of the sitemap file that I didn't want there. Thanks for taking a look. –  mezmo Sep 12 '12 at 14:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.