Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. SharePoint
  4. PortalSiteMapProvider is empty with anonymous access

PortalSiteMapProvider is empty with anonymous access

Scheduled Pinned Locked Moved SharePoint
sharepointdata-structuressecurityannouncement
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bob e baker
    wrote on last edited by
    #1

    I am trying to use PortalSiteMapProvider to create a tree view Site Map, however, secruity trimming is limiting the results. If you access the page anonymously or with permissions to a grandchild site only, the tree does not build because the provider is empty. I have tried using RunWithElevatedPrivileges with no success. Everything I read about SiteMap providers say the bey default do not use security trimming unless you set the flag to true in the web config. I have verified it is not set. I am open to all suggestions to include a completlydifferent solution for a treeview sitemap. I am including a simple version of the code with the treeview removed.

    SPSecurity.RunWithElevatedPrivileges(delegate()
    {
    // Gets a new security context using SHAREPOINT\system

    using (SPSite site = new SPSite(this.Page.Request.Url.ToString()))
    {
        using (SPWeb thisWeb = site.OpenWeb())
        {
            PortalSiteMapProvider sitemapprovider = (PortalSiteMapProvider)SiteMap.Providers\["GlobalNavSiteMapProvider"\];
    
            foreach (SiteMapNode node in sitemapprovider.GetChildNodes(sitemapprovider.TryGetRootNode))
            {
                //Use the child node
                this.Controls.Add(new LiteralControl(node.Title + "<br>"));
                this.Controls.Add(new LiteralControl(node.Key + "<br>"));
                this.Controls.Add(new LiteralControl(node.Url + "<br>"));
    
            }
        }
    }
    

    });

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups