SharePoint 2010 Access Denied Web Part Error

After upgrading to SharePoint 2010 some web part pages are showing an Error Web Part Error: Access denied. You do not have permission to perform this action or access this resource.“.  For sites without anonymous access, this can be mitigated with audience targeting of the web part. However, if that does not work or you need to have the page be anonymously accessible, but also have web parts on that page that have limited permissions, then you will need a different solution. This is not the perfect solution you are looking for, I am still waiting on Microsoft for that as well, but this is a simple jQuery trick that will hide that awful error and make the page render as you would expect (MOSS 2007 functionality). Just follow the following steps:

  1. Download the latest version of jQuery from their site: and upload it to your server.
  2. At the bottom of the page add a content editor web part and make it hidden.
  3. Add the following code:

<script src=”your-server/jquery-1.6.1.min.js”></script>
<script language=”javascript”>
$(“div:contains(‘Access denied’):not(:has(div))”).hide();

The first line is a reference to the latest version of jQuery on your server. Please remove “your-server” and replace with the correct folder (don’t use absolute references). Make sure this reference works. (It is also possible to link to a Google hosted version of this file however I always use a local copy.) The second line is the beginning tag for writing JavaScript. The 3rd line finds all the “span” elements on the page that contain the word “Error” and then hides them. This might work too well so you need to make sure nothing else on the page is hidden as well that you don’t want hidden. The fourth line finds all the “div” elements that contain “Access denied”, but do not contain any other “div” elements, and hides them. This is crucial as I was unable to hide a “span” and had to use a “div” find and hide. However, since “div” tags are nested throughout this page without the caveat that makes sure the “div” tag doesn’t contain any nested “div” tags, this would have hidden most of the items on the page. The fifth line closes the script tag.

Tim Ferro