Run-time manipulation of the sitemap

May 23, 2007 at 4:26 AM
I have the need to construct a portion of the sitemap information from info retrieved from a database, being dependant upon the logged-in user's credentials.

Is it possible to manipulate the sitemap in this manner?
May 24, 2007 at 3:00 PM
Hi!

You can inject siteMapBuilderService with ServiceDependency attribute, then get your info from your database and then create a module dynamically with:

SiteMapNodeInfo moduleNode = new SiteMapNodeInfo("key", "url", "title");

Then you can add the node to the sitemap like:

siteMapBuilderService.AddNode(moduleNode);

I found the “How to: Add Module Pages to the Site Map” section under WCSF’s documentation very useful when doing something similar.

Hope it helps!

Luciano Panaro
http://staff.southworks.net/blogs/lpanaro
May 24, 2007 at 10:45 PM
Luciano,

Thanks. However, I need to do more than that.

An example may illustrate my scenario...

Every logged-on user shall have this 'basic' structure:
ParentNode
+--- Child1
+--- Child2

If UserA logs on, then the structure shall be
ParentNode
+--- Child1
+---- ChildX of Child1
+--- Child2

If UserB logs on, then the structure shall be
ParentNode
+--- Child1
+---- ChildY of Child1
+--- Child2

Any help will be greatly appreciated.

John