3

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)

4 Answers 4

1

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.

3
+25

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()
0
1

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.

0

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
}

?

6
  • I didn't find any usefull data about this on Sharepoint Logs
    – Hamed
    Commented Apr 27, 2011 at 14:52
  • How to attach debugger?
    – Hamed
    Commented Apr 29, 2011 at 16:53
  • System.Diagnostics.Debugger.Break();
    – AlexSSE
    Commented Apr 30, 2011 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
    Commented May 3, 2011 at 17:30
  • 1
    I dont think he can add the SPSecurity becuase he is using an OOTB web part... Commented May 4, 2011 at 18:11

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.