Вопрос

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

Это было полезно?

Решение

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

Другие советы

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.

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top