2

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

1

3 Answers 3

2

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

0

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.

1
  • i've just made this work on sandbox: PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(web); however this does NOT: PublishingWeb.IsPublishingWeb(web)
    – zee
    Commented Nov 21, 2011 at 23:21
0

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.

1
  • 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
    Commented Nov 21, 2011 at 23:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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