I have a Picture Library and am trying to use the CQWP to display a list of items in the library. The web part shows the items fine in authenticated mode, but it fails to show the items to anonymous users.
The error log message is:
Error while executing web part: System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.SetDocumentIconUrlAndOnClickString(SPWeb web, DataRow row, String strDefaultItemOpen, Boolean fSetDocIcon, Boolean fSetOnClick, String fileRefColumnRef, String progIdColumnRef, String fsobjTypeColumnRef, String permMaskColumnRef)
at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.PreProcessForDocumentIconAndOnClickAttribute()
at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.AddContentQueryData()
at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.GetXPathNavigator(String viewPath)
at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform)
I'm running SP 2010. I've tried various scenarios including: 1. Using the default publishing template. 2. Using the blank site template with publishing and lock down features enabled. 3. Using the default Images lib that comes with the Publishing feature. 4. Using a standard document library with image files uploaded (GIF files). Note: if the doc lib doesn't have any image type files, the CQWP works as expected in anonymous mode. It fails as soon as I put in an image file. 5. Using the Default item style to display the item list. 6. Using my custom item style that outputs only the SafeUrlLink and DisplayTitle.
I've been throwing myself at this for quite some time but still haven't figured it out. Please help! Thanks.