SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

According to these two articles, Sandboxing supports 'Navigation'--

But when I try to implement a simple line of code in a sandboxed web part..

            SiteMapNode node = PortalSiteMapProvider.CurrentNavSiteMapProvider.RootNode;
            Controls.Add(new Literal
                Text = node.Title
        catch (Exception ex)
            throw ex;

..I get this error: "The provider 'AspNetXmlSiteMapProvider' specified for the defaultProvider does not exist in the providers collection."

I haven't touched the OOTB web.config file, for '<'providers'>' or anything

I don't get the error if I deploy the exact same project as a Farm solution.

MSDN doesn't say anything about Navigation components --

share|improve this question
this one says it too --… – zee Nov 21 '11 at 2:26
up vote 2 down vote accepted

This lists all the namespaces and classes that Sandbox supports -- .. Microsoft.SharePoint.Navigation is supported, but not Microsoft.SharePoint.Publishing.Navigation

share|improve this answer

PortalSiteMapProvider exists in SharePoint Server as part of the Publishing Features, so it wouldn't surprise me if they weren't supported in the Sandbox.

When people quote what's supported, it's usually third (or even fourth) hand accounts (often without sources) of something as part of a component that happened to work one time. I always stick by the 'try it and see' method if there's something I'm not sure about, as with the Sandbox it either works or it doesn't.

share|improve this answer
i've just made this work on sandbox: PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(web); however this does NOT: PublishingWeb.IsPublishingWeb(web) – zee Nov 21 '11 at 23:21

Sandbox Solutions are not able to access any information outside the scope of Site Collection. The providers are configured in web.config which Sandbox cannot access normally.

share|improve this answer
yes, that's why i haven't touched the web.config files. does that mean the portalsitemapprovider needs to access the web.config files, and is not able to, which is why the code above doesn't work? – zee Nov 21 '11 at 23:17

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.