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

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

http://www.sharepointusecases.com/index.php/2010/03/introduction-to-sharepoint-2010-sandbox-solutions-for-site-collection-owners/

http://www.chakkaradeep.com/post/SharePoint-2010-Sandboxed-Solutions.aspx

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

    try
        {
            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 -- http://msdn.microsoft.com/en-us/library/gg615464.aspx

share|improve this question
    
this one says it too -- nothingbutsharepoint.com/sites/devwiki/SP2010Dev/Pages/… –  zee Nov 21 '11 at 2:26
add comment

3 Answers

up vote 2 down vote accepted

This lists all the namespaces and classes that Sandbox supports -- http://msdn.microsoft.com/en-us/library/ee537860.aspx .. Microsoft.SharePoint.Navigation is supported, but not Microsoft.SharePoint.Publishing.Navigation

share|improve this answer
add comment

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
add comment

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
add comment

Your Answer

 
discard

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.