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)


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.

| improve this answer | |

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")
| improve this answer | |

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.

| improve this answer | |

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:

 // Code goes here


| improve this answer | |
  • I didn't find any usefull data about this on Sharepoint Logs – Hameds Apr 27 '11 at 14:52
  • How to attach debugger? – Hameds Apr 29 '11 at 16:53
  • System.Diagnostics.Debugger.Break(); – AlexSSE Apr 30 '11 at 11:01
  • Do you need to use elevated permissions with this? I know we do that for certain web parts in our environment to get data that normally would be restricted. – MichaelF May 3 '11 at 17:30
  • 1
    I dont think he can add the SPSecurity becuase he is using an OOTB web part... – Johnny Tordgeman May 4 '11 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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