PotalSiteMapProvider doesn't return pages. I use the code as follows:
PortalSiteMapProvider prov = PortalSiteMapProvider.CurrentNavSiteMapProviderNoEncode;
prov.DynamicChildLimit = 0;
prov.IncludeSubSites = PortalSiteMapProvider.IncludeOption.Always;
prov.IncludePages = PortalSiteMapProvider.IncludeOption.Always;
prov.IncludeHeadings = true;
prov.IncludeAuthoredLinks = true;
SiteMapNode root = prov.RootNode;
//prov.IncludePages = PortalSiteMapProvider.IncludeOption.Always;
SiteMapNodeCollection collection = prov.GetChildNodes(root);
foreach (SiteMapNode thisNode in collection)
{
SiteMapNodeCollection thisCollection;
if (thisNode.GetType() == typeof(PortalWebSiteMapNode))
{
prov.IncludePages = PortalSiteMapProvider.IncludeOption.Always;
thisCollection = prov.GetChildNodes((PortalWebSiteMapNode)thisNode);
}
}
As I look it through debugger, thisCollection never has any children, though thisNode is a SubSite Node that has pages. What am I doing wrong and how can I get pages, that are in that node? Thanks!
This is the code I used in a project awhile back. It seemed to pull subpages properly for me.