Pergunta

I'm trying to connect the SharePoint 2010 Chart Web Part to SharePoint list. It's all good but anonymous can't see the chart and I get this error:

Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Office.Server.WebControls.Chart.RenderChartControl(Control chartToRender, HtmlTextWriter writer) at Microsoft.Office.Server.WebControls.Chart.Render(HtmlTextWriter writer) at Microsoft.Office.Server.WebControls.ChartWebPart.Render(HtmlTextWriter writer)

Foi útil?

Solução

This is a bug and it's solved in SP2010 SP1 (didn't test it though). Here is the link to the kb article which describes all the changes in the xslx file: http://support.microsoft.com/kb/2460045 Row 234 describes the issue you're referring to.

Outras dicas

I'm not that familiar with the Chart web part but from checking it out my guess is that it have the same issues with anonymous user as client object model based web parts (like Silverlight based web parts) have.
The problem is that by default SharePoint restrict the GetItems method of SPLIst for anonymous users.
You should check out Waldek Mastykarz's post about this issue, but to summarize his great solution, use the following PowerShell code (dont forget to replace http://sharepoint with your site url):

$wa = Get-SPWebApplication -Identity "http://sharepoint"
$wa.ClientCallableSettings.AnonymousRestrictedTypes.Remove([Microsoft.SharePoint.SPList], "GetItems")
$wa.Update()

If the problem is that autenticated users see the chart, but anonymous don't, the problem is probably a permissions-issue. Make sure that no files you use needs restricted access.

If you don't figure it out, do as @Disciple suggested, attach a debugger.

Not enough info to answer. What other info is in SharePoint Logs? Try to attach debugger or use logging. Most likely smth is not initialized before accessing.

UPD: Are all resources used be the page published?

UPD2: MichaelF has a point. Have you tired using smth like:

SPSecurity.RunWithElevatedPrivileges(delegate
{
 // Code goes here
}

?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange
scroll top